Ubuntu 14.04
Sponsored Link

PHP + PHP-FPM2016/01/27

 
Install PHP-FPM to make PHP scripts be fast.
[1]
[2] Install PHP-FPM.
root@www:~#
apt-get -y install php5-fpm libapache2-mod-fastcgi
[3] Configure Apache2.
root@www:~#
vi /etc/php5/fpm/pool.d/www.conf
# line 33: change

listen =
127.0.0.1:9000
root@www:~#
vi /etc/apache2/sites-enabled/000-default.conf
# add into <VirtualHost> - </VirtualHost>

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
</VirtualHost>

root@www:~#
a2enmod proxy_fcgi

Considering dependency proxy for proxy_fcgi:
Module proxy already enabled
Enabling module proxy_fcgi.
To activate the new configuration, you need to run:
  service apache2 restart
root@www:~#
initctl restart php5-fpm

php5-fpm start/running, process 1255
root@www:~#
/etc/init.d/apache2 restart

 * Restarting web server apache2
   ...done.
[4] create phpinfo and access to it, then it's OK if "FPM/FastCGI" is displayed.
root@www:~#
echo '<?php phpinfo(); ?>' > /var/www/html/info.php

Matched Content