Configuring Apache with FastCGI PHP-FPM for a Slim Application

Configuring PHP-FPM

On Ubuntu or Debian, using the Ondřej Surý repository of PHP with versions, you can install php-fpm with:

sudo apt install php7.2-fpm

The configuration files are at /etc/php/7.2/fpm/ and /etc/php/7.2/fpm/pool.d/.

PHP-FPM manages pools of processes, starting them before a request comes in, and shutting them down when the number of requests decline. You can have more than one pool, and each pool is like a separate server, tuned separately — but it comes with one default pool, configured with /etc/php/7.2/fpm/pool.d/www.conf.

I changed the following settings:

# chdir to the docroot
chdir=/www/riceball.com/public/
# don't clear the environment
clear_env=no

I don’t know if these were necessary, but that’s what got changed.

After each configuration, restart the server:

sudo service php7.2-fpm restart

Leave a Reply