Bitnami PHP-FPM for Google Cloud Platform

PHP-FPM is an alternative PHP FastCGI implementation with additional features.

How to configure PHP-FPM options?

To override any of the PHP configuration options (eg. memory_limit, max_execution_time), set these options in the /opt/bitnami/php/etc/php.ini file and in the /opt/bitnami/apps/APPNAME/conf/php-fpm/php-settings.conf file.

For example, to increase the PHP memory limit, edit the /opt/bitnami/APPNAME/conf/php-fpm/php-settings.conf file and set the corresponding variable as follows. Replace the NEW_LIMIT placeholder with the new memory limit you wish to use.


Then, also modify the /opt/bitnami/php/etc/php.ini file and set the memory_limit variable to a new value, as shown below:


Restart Apache and PHP-FPM for the changes to take effect:

$ /opt/bitnami/ restart apache
$ /opt/bitnami/ restart php-fpm

How to configure PHP-FPM processes?

It is possible to configure PHP-FPM processes per application. If you have a lot of applications, this may result in excessive CPU usage.

  • You can configure your application's PHP-FPM processes to start automatically when needed. Add this option to the /opt/bitnami/apps/APPNAME/conf/pfp-fpm/pool.conf file:

  • You can also reduce the number of PHP-FPM processes per application by modifying the files below.

    • If you configured the processes to start dynamically, modify the /opt/bitnami/php/etc/common-dynamic.conf as below:

    • If you configured the processes to start on demand, modify the /opt/bitnami/php/etc/common-ondemand.conf as below:


How to disable PHP-FPM?

To disable an already enabled PHP-FPM configuration, follow these steps:

  • Disable mpm_event by commenting the LoadModule directive:

     #LoadModule mpm_event_module modules/
  • Enable mpm_prefork by uncommenting its LoadModule directive:

     LoadModule mpm_prefork_module modules/
  • Enable mod_php by uncommenting its LoadModule directive:

     LoadModule php5_module  modules/
  • Restart Apache:

     $ /opt/bitnami/ restart apache
  • Stop PHP-FPM:

     $ /opt/bitnami/ stop php-fpm
  • Disable PHP-FPM:

     $ sudo mv /opt/bitnami/php/scripts/ /opt/bitnami/php/scripts/

How to enable PHP-FPM?

PHP-FPM is enabled by default. In case you find that it is not, follow these steps to re-enable it:

  • Enable its control script:

     $ cd /opt/bitnami
     $ mv php/scripts/ php/scripts/
  • Start PHP-FPM:

     $ cd /opt/bitnami
     $ ./ start php-fpm
  • Enable PHP-FPM configuration in Apache. Update the /opt/bitnami/apache2/conf/httpd.conf file and comment out the LoadModule directive:

     # Comment the below module to enable PHP-FPM
     # LoadModule php5_module  modules/
     # This enables using PHP-FPM when mod_php is disabled
     <IfModule !php5_module>
         Define USE_PHP_FPM
  • In the same file, disable the mpm_prefork module:

     #LoadModule mpm_prefork_module modules/
  • In the same file, enable the mpm_event module:

     LoadModule mpm_event_module modules/
  • Restart Apache:

     $ cd /opt/bitnami
     $ ./ restart apache


PHP-FPM did not handle the connection error

PHP-FPM is configured such that PHP requests are delivered to the appropriate PHP-FPM pool. It may happen, however, that none of those pools consumes the request, either because it is a custom application that was not configured to use PHP-FPM, or because of a misconfiguration.

In these cases, Apache tries to serve the plaintext version of the PHP file (its source code), which may contain sensitive information. To avoid this, we have configured the server to throw an error of the form:

Not Found
The requested URL /bitnami-error-php-fpm-did-not-handle-the-connection/info.php was not found on this server.

If you come across this error, please post a question in our community forums and we will help you troubleshooting the error and release a fixed version of the misconfigured application if needed.


Bitnami Documentation