Installation of PHP and PHP-FPM
Download the installation package
Download PHP source package from Www.php.net official website, here is php-5.2.17.tar.bz2,
Download the corresponding PHP-FPM source package from http://php-fpm.org/downloads/, here is php-5.2.17-fpm-0.5.14.diff.gz
2. Start compiling and installing PHP and PHP-FPM
[Email protected] ~]# tar jxf php-5.2.17.tar.bz2
[Email protected] ~]# GZIP-CD php-5.2.17-fpm-0.5.14.diff.gz |patch-d php-5.2.17-p1
[Email protected] ~]# CD php-5.2.17
[Email protected] php-5.2.17]#/configure--prefix=/usr/local/php--enable-fastcgi--enable-fpm
[[email protected] php-5.2.17]# make &&make Install
[email protected] php-5.2.17]# CP Php.ini-dist/usr/local/php/lib/php.ini
3. Configure the default configuration file for PHP-FPM
[Email protected] php-5.2.17]# vim/usr/local/php/etc/php-fpm.conf
Unix User of processes
<value name= "user" >nobody</value>
Unix Group of processes
<value name= "group" >nobody</value>
Process Manager Settings
About 62 lines, remove the comments from the two lines
4. Start the fastcgi process
[Email protected] php-5.2.17]#/usr/local/php/bin/php-cgi--FPM
Or
[[email protected] php-5.2.17]#/usr/local/php/sbin/php-fpm start
To see if ports and processes are started
[Email protected] php-5.2.17]# netstat-antl| grep 9000
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
[Email protected] php-5.2.17]# Ps-ef | grep php-cgi
Root 6922 1 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.conf
Nobody 6923 6922 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.conf
Nobody 6924 6922 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.conf
Nobody 6925 6922 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.conf
Nobody 6926 6922 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.conf
Nobody 6927 6922 0 16:44? 00:00:00/usr/local/php/bin/php-cgi--FPM--fpm-config/usr/local/php/etc/php-fpm.con
5. Configure Nginx support PHP
[Email protected] php-5.2.17]# vim/usr/local/nginx/conf/nginx.conf
#user nobody;
Worker_processes 1;
#error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;
#pid Logs/nginx.pid;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
#log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
# ' $status $body _bytes_sent ' $http _referer '
# ' "$http _user_agent" "$http _x_forwarded_for" ';
#access_log Logs/access.log Main;
Sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
Keepalive_timeout 65;
#gzip on;
server {
Listen 80;
server_name 192.168.8.64;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{
# root HTML;
index index.html index.php;
}
location ~ \.php$ {
Root & nbsp; /usr/local/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param script_filename /usr/local/nginx/ Html$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html;
# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
Restarting the Nginx process
[Email protected] php-5.2.17]# Ps-ef | grep nginx
Root 6946 1 0 16:49? 00:00:00 Nginx:master Process/usr/local/nginx/sbin/nginx
Nobody 6947 6946 0 16:49? 00:00:00 Nginx:worker Process
[email protected] php-5.2.17]# kill 6946
[Email protected] php-5.2.17]#/usr/local/nginx/sbin/nginx
So far, nginx+php has been configured to complete
6. Test Nginx's parsing function for PHP
Under the/usr/local/nginx/html directory, create a phpinfo.php file that reads as follows:
<?php phpinfo ();?>
In the browser to access http://192.168.8.64/phpinfo.php, if you can parse normally, the PHP installation configuration and Feature list statistics will appear. 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/3C/wKiom1Pkn1CBftN-AAMmPF-b-8Y945.jpg "title=" Qq20140808171941.png "alt=" Wkiom1pkn1cbftn-aammpf-b-8y945.jpg "/>
This article from "Dream Three" blog, declined reprint!