In this article we are setting up apache to run PHP as a fastCGI process server, and address that fastCGI server directly from within apache, via a dedicated proxy module (mod_proxy_fcgi.). In other words we configure apache php-fpm on centos7 or it means that we can now run php code using only stock apache and php binaries. No need to configure anything like suphp, mod_php or suexec. Feel free to implement the idea if you have centos 6 or even the newer centos 8.
Create below two directories.
Create a file Named example.conf using below command.
Add below content in above example.conf file.
Create Below Directories and files.
Allow Apache to read the conf files from the /etc/httpd/sites-enabled folder. For that we are going to add following line at the end of /etc/httpd/conf/httpd.conf file.
Now go the folder named /etc/php-fpm.d and create a file named example.conf and add below content.
Add below content in example.conf file.
This concludes the installation and configuration apache with php-fpm. Now if you visit the phpinfo page, we can see FPM/FastCGI in the ServerAPI field. Take a look at the below screenshot. Leave your thoughts at the comment box.