Set up php-fpm

If you want to use the compiled PHP version from your webserver (e.g. Apache or Nginx), you need to use php-fpm.

➜  cd ~/php/php8
➜  cp etc/php-fpm.conf.default etc/php-fpm.conf
➜  cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
# adapt the two config files if needed

If you want to improve performance, you might want to increase pm.max_children, pm.start_servers and pm.max_spare_servers.

You can also create a lib/php.ini with custom settings:

display_startup_errors = Off
display_errors = Off
log_errors=1
error_log=/tmp/phperror
memory_limit = 512M

Now you can start php-fpm using

➜  ~/php/php8/sbin/php-fpm --nodaemonize

php-fpm will be listening on port 9000 by default.

Now you can update your webserver configuration to point to your php-fpm. How exactly this works, depends on your webserver. But in Nginx something like this will work:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass 127.0.0.1:9000;
}

Revision #2
Created Thu, Aug 12, 2021 10:41 AM by Lukas
Updated Thu, Aug 12, 2021 10:54 AM by Lukas