In the previous section, we talked about how to install the MySQL service under CentOS7.0, if you do not see the Welcome page of friends, you can add my personal detailed chat: litao514148204
Attach a section address: http://www.cnblogs.com/riverdubu/p/6426852.html
About PHP-FPM
Nginx itself cannot handle PHP, it is just a Web server, when the request is received, if it is a PHP request, then sent to the PHP interpreter processing, and return the results to the client.
Nginx is generally the request to send fastcgi management process processing, FASCGI management process Select CGI subprocess processing results and return to Nginx.
PHP-FPM is a PHP fastcgi manager that is used only for PHP.
PHP after 5.3.3 has spoken php-fpm written to the PHP source code core. So there is no need to download another.
Get PHP
Why choose 5.6.30 This version, because study, not study. Admittedly, 7.0 has added a lot of new PHP features, performance is also some of the improvements, if it is research, it can be a toss, after the hollow to talk about the 7.0 version and how to switch between the various PHP versions.
Open PHP's official website: http://php.net/, view a list of PHP versions
Right click, copy the link address, log on to the remote host, download the software (I chose Australia host mirror download)
# wget Http://au1.php.net/get/php-5.6.30.tar.gz/from/this/mirror
Download down is a mirror file, change to the file name we need
#mv Mirror Php-5.6.30.tar.gz#tar zxvf php-5.6.30.tar.gz#cd php-5.6.30
Configure the installation
To enter the directory, we need to configure the installation directory to/usr/local/php/in the installation
#./configure--prefix=/usr/local/php--with-curl--with-freetype-dir--with-gd--with-gettext--with-iconv-dir-- With-kerberos--with-libdir=lib64--with-libxml-dir--with-mysql--with-mysqli--with-openssl--with-pcre-regex-- With-pdo-mysql--with-pdo-sqlite--with-pear--with-png-dir--with-xmlrpc--with-xsl--with-zlib--enable-fpm-- Enable-bcmath--enable-libxml--enable-inline-optimization--enable-gd-native-ttf--enable-mbregex-- Enable-mbstring--enable-opcache--enable-pcntl--enable-shmop--enable-soap--enable-sockets--enable-sysvsem-- Enable-xml--enable-zip
The following error may be reported in the configuration process
Error 1:
Xml2-config not found. Please check your LIBXML2 installation.
Solutions
Installing LIBXML2 related components
#yum Install Libxml2#yum Install libxml2-devel-y
Error 2:
Please reinstall the Libcurl distribution- easy.h should is in <curl-dir>/include/curl/
Installing Curl related components
#yum Install Curl Curl-devel
Error 3:
Configure:error:png.h not found.
Installing libpng related components
#yum Install Libpng#yum Install Libpng-devel
Error 4:
Freetype-config not found.
Installing FreeType related components
#yum Install Freetype-devel
Error 5:
Xslt-config not found. Please reinstall the LIBXSLT >= 1.1.0 distribution
Installing LIBXSLT related components
#yum Install Libxslt-devel
OK, when we see this sentence, it means that your PHP has been configured to complete!
Next we just need to compile the installation to complete the installation of PHP
#make && make Install
See this sentence to show that the installation is complete!
For the sake of insurance, let's make a test to see if it really worked.
Configuring the related php.ini configuration
The first thing we need to configure is php.ini this file
The installation directory has 2 files: php.ini-development and Php.ini-production
Php.ini-production on-line version use
Php.ini-development Development Version Use
We choose development to configure
# CP Php.ini-development/usr/local/php/lib/php.ini
PHP-FPM Configuration
Copy the PHP-FPM configuration file
#cp-R./sapi/fpm/php-fpm.conf/usr/local/php/etc/php-fpm.conf
Copy enable file
#cp-R./SAPI/FPM/PHP-FPM/ETC/INIT.D/PHP-FPM (deprecated, see note 1 for details)
Start
#/etc/init.d/php-fpm
See if PHP started successfully
#ps aux | grep php
See this to show that your PHP has started successfully!
Restart and shutdown
#kill-9 Process number #/etc/init.d/php-fpm
Configuring Nginx Support PHP
Enter Nginx main directory,/usr/local/nginx;
#cd/usr/local/nginx
Go to configuration directory
#cd conf
Nginx support PHP needs to modify nginx.conf
#vim nginx.conf
To open the following code, let Nginx support PHP, in the server code snippet.
After modifying, this code becomes, red part is our host directory is/usr/www, need to modify Fastcgi_param script_filename point to corresponding directory:
Set the home directory to/usr/www.
Comment out the root line, add a line: root/usr/www;
Save exit.
We re-start the Nginx service, as explained in the Nginx chapter.
#/etc/init.d/nginx restart
If you do not follow our method configuration in Nginx, you can restart the Nginx service in the following way
#/usr/local/nginx/sbin/nginx-s Reload
Restart success! Below we add a new file under the/usr/www directory.
#vim/usr/www/phpinfo.php
Insert the following content
<?php phpinfo (); ? >
Open in Browser http.//Remote ip/phpinfo.php
See this page, congratulations, your PHP has been installed configuration completed. You can see all the PHP dependent components on this page, the next section I will explain this page in detail, if you have any questions about this section, welcome to the comment area and I exchange discussions, there will be a message back. ^_^
Note
Easy way to set up PHP startup and PHP Services
In the above method, I have a problem copying PHP-FPM service, should not directly copy the PHP-FPM executable file to/etc/init.d/directory, should be PHP to our prepared init.d.php-fpm.
#cp./sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm
Add the PHP-FPM service to the Chkconfig list
#chkconfig--add PHP-FPM
Set up boot from
#chkconfig PHP-FPM on
The way to restart and stop PHP later is
#service php-fpm start#service php-fpm stop#service php-fpm restart#service php-fpm Reload
The above is my problem, please correct it in time.
Installing PHP5.6.30 service under "CNMP series" CentOS7.0