PHP source code compilation and installation simple arrangement PHP source code compilation and installation configuration
Http://php.net/downloads.php
Pre-installed dependencies in CentOS. you can add dependencies by yourself. Generally, the following is sufficient.
Yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel-y
Add common PHP configurations
./Configure -- prefix =/usr/local/php \
-- With-config-file-path =/usr/local/php/etc -- with-bz2 -- with-curl \
-- Enable-ftp -- enable-sockets -- disable-ipv6 -- with-gd \
-- With-jpeg-dir =/usr/local -- with-png-dir =/usr/local \
-- With-freetype-dir =/usr/local -- enable-gd-native-ttf \
-- With-iconv-dir =/usr/local -- enable-mbstring -- enable-calendar \
-- With-gettext -- with-libxml-dir =/usr/local -- with-zlib \
-- With-pdo-mysql = mysqlnd -- with-mysqli = mysqlnd -- with-mysql = mysqlnd \
-- Enable-dom -- enable-xml -- enable-fpm -- with-libdir = lib64 -- enable-bcmath
Last
Make & make install
Copy the PHP configuration file and the FPM configuration file. the default port of FPM is 9000. Nginx uses this port to proxy the FastCGI module of PHP.
Cp php. ini-production/usr/local/php/etc/php. ini
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php-5.5.0/etc/php-fpm.conf
Add the following section to connect to PHP fast cgi in the server section of Nginx. conf:
Location ~ . * \. (Php )? $
{
Expires-1 s;
Try_files $ uri = 404;
Fastcgi_split_path_info ^ (. + \. php) (/. +) $;
Include fastcgi_params;
Fastcgi_param PATH_INFO $ fastcgi_path_info;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Fastcgi_pass 127.0.0.1: 9000;
}
Test whether the syntax is correct
Nginx-t
Start php-fpm after it is started under the sbin Directory of the php Installation Path
Ps-ef | grep fpm to view the php-fpm information
Start Nginx and Nginx has connected to the fastcgi service provided by php-fpm.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.