It’s designed to speed up PHP processors and scripts. If you’re running a PHP-based website or blog, like WordPress, Joomla, or others, you may want to install and enable PHP-FPM to speed it up. This brief tutorial shows students and new users how to install and configure Apache or Nginx web servers to use PHP-FPM. Most WordPress setups will have the PHP-FPM module installed and configured. Not many on Apache, but enabling it for Apache may also provide benefits So, to speed up your PHP-based websites, follow the steps below: This tutorial assumes that you have already installed Apache2 or Nginx webserver and they’re functioning okay. The steps below enable Apache / Nginx to route PHP requests through PHP-FPM to handle.

Install PHP-FPM and Apache2 Module

To get PHP-FPM installed and enabled on Apache, run the commands below: After running the commands above, the module should be installed and ready to use. To configure Apache to use it continue below.

Configure Apache2 to use PHP-FPM

Now that the module is installed, open the default configuration file for the module and configure the highlighted settings below. Then change the highlighted settings below.

Configure Apache2 Default Site

Now that PHP-FPM is installed and configured, open the Apache default site by running the commands below Then add the highlighted lines between the VirtualHost block and save the file. Save the file and continue below Finally, enable proxy_fcfi by running the commands below After that, restart Apache2 and PHP-FPM to load the settings. Test if PHP is loaded by running the commands below. Then browse to the server hostname or IP address followed by /info.php. ex: http://192.168.41.2/info.php

Enable PHP-FPM on Nginx

For Nginx, run the commands below to install PHP-FPM. By default, PHP-FPM is set up to communicate over a Unix socket so no changes there. Nginx will handle the communications over Unix socket. Then open the Nginx default site configuration file by running the commands below: When the file opens, add the highlighted line to the PHP block and save. Save your settings. Restart Nginx and PHP-FPM by running the commands below That’s it! Test PHP by running the commands below. You may also like the post below: