CentOS 6
Sponsored Link

FastCGI + PHP-FPM2014/09/13

 
Use FastCGI + PHP-FPM to PHP be more Fast.
[1]
[2]
[3] Install mod_fastcgi and php-fpm.
# install from RPMForge

[root@www ~]#
yum --enablerepo=rpmforge -y install mod_fastcgi php-fpm
[3] Configure httpd.
[root@www ~]#
vi /etc/httpd/conf.d/fastcgi.conf
# line 18: comment out

#
FastCgiWrapper On
# add follows to the end

AddHandler php-fastcgi .php
Action php-fastcgi /php5-fcgi/php-fpm
ScriptAlias /php5-fcgi/ /var/www/php5-fcgi/
FastCGIExternalServer /var/www/php5-fcgi/php-fpm -host 127.0.0.1:9000
[root@www ~]#
mkdir /var/www/php5-fcgi

[root@www ~]#
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.bak

[root@www ~]#
/etc/rc.d/init.d/php-fpm start

Starting php-fpm: [ OK ]
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@www ~]#
chkconfig php-fpm on

[4] Create a test phpinfo script and make sure PHP-FPM is active like follows.
[root@www ~]#
echo -e "<?php\nphpinfo();\n?>" > /var/www/html/phpinfo.php

Matched Content