Introduction

Apache is popular web server software which is mostly used in our server environment by hosting providers and it handles php through default handler which is cgi .PHP5-FPM is FastCGI implementation for PHP. it uses as backed application for php to run php cgi as fast compare to normal cgi application. It is useful for processing PHP scripts for large traffic sites.

Apache runs by default with mod_php which takes more resources then php-fpm. So we are here going to install php-fpm with apache to compile php scripting through php-fpm.

Installation Steps

Step 1. Install apache2 with mod-mpm-event

First of all update repository and install apache with mpm event.

When apache successfully install we can check apache service if it’s running

if it’s not running you can start it by following command-

Step 2.  Install libapache2-mod-fastcgi

Next we have to install libapache2-mod-fastcgi module for apache to working with php-fpm.

As this module is not included with default repo so we have to add repolist in apt repository.

Open below files and add repository location

Copy above lines and add in sources.list at the end of file.

Now update repository and install apache module

Step 3. Install php5-fpm

Install php-fpm with following command

Step 4. Configure Php-fpm with apache

Create new file and configure php-fpm for apache

add the following line of code in above file –

After completion of configuration of php-fpm we need to enable this module with apache and enable php-fpm configuration as well.

Finally we can restart apache service for take effect

Step 5. Testing

Create a phpinfo file for checking if everything works as per our requirement.

Add the following line of code

And check through http://server-ip-address/phpinfo.php

php5-fpm

You will see fastcgi/FPM for apache handler.

To know more about php5-fpm please click here !!!