Install the lamp environment yum in centos

Source: Internet
Author: User
Tags php write
Nginx check whether the yum source has nginx
yum  list nginx
Since the official source does not have nginx, we need to find it by ourselves. This is the other system I am looking for. Please check the http://wiki.nginx.org/Install.
[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1
$ Releasever is your centos version. My centos6.3, so yes.
Http://nginx.org/packages/centos/6/?basearch/


Run the following command and copy the above Code
vi /etc/yum.repos.d/nginx.repo
 
yum install nginx

In this way, the installation is complete.

Start nginx
 /etc/init.d/nginx start
View Processes
ps -ef | grep nginx

You can enter an IP address for access through a browser (note that the firewall is off)

PHP
yum list php php-fpm
yum install php php-fpm
Start PHP-FPM
 /etc/init.d/php-fpm  start

PHP and nginx normally do not overlap. here we need to change the nginx configuration file to enable FastCGI

vim /etc/nginx/conf.d/default.conf

Remove comments from the green block. to modify the two red blocks in the green block, use the above as the root directory of the website.

Restart nginx
/etc/init.d/nginx restart

 

Create a phpinfo. php Write File under/usr/share/nginx/html
 <?php     phpinfo(); ?>

Access it from the browser.

You can also directly access it using PHP.

php  /urs/share/nginx/html/phpinfo.php

 

 

----------------------- PHP-fpmphp and nginx normally there is no intersection of the interaction protocol to process the interaction between PHP and nginx FastCGI protocol when nginx processes PHP files, it is passed to the FastCGI parser of PHP through the FastCGI protocol, the fast-CGI parser executes the request and returns the generated content to nginx. nginx sends the content to the user's browser, PHP-FPM, parses the fast-CGI protocol, and calls the CGI parser of PHP, fastCGI Process Manager is the FastCGI Process Manager of PHP. ----------------------- MySQL
yum list mysql mysql-server

 

yum install mysql mysql-server

 

mysql_install_db
// Initialize the script and create your own system database MySql in MySQL
Mysqld_safe & // background startup
Enter MySQL (note that your password is blank now)
mysql -uroot
MySQL extension is not installed by default for PHP installed in yum.
Yum list PHP-mysql // PHP install MySQL extension

 

All installed now

 

PHP, MySQL, and nginx Status Management

/etc/init.d/nginx  stop/etc/init.d/nginx  start/etc/init.d/nginx  restart/etc/init.d/mysqld stop/etc/init.d/mysqld start/etc/init.d/mysqld restart/etc/init.d/php-fpm start/etc/init.d/php-fpm restart/etc/init.d/php-fpm stop

 

 
 

 

Install the lamp environment yum in centos

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.