CentOS 7 Apache use PHP-FPM

Install PHP-FPM with command

yum install php-fpm

Edit www.conf

vi /etc/php-fpm.d/www.conf

Find

listen = 127.0.0.1:9000

Replace with

listen = /var/run/php-fpm/default.sock

Find

;listen.owner = nobody
;listen.group = nobody

Replace with

listen.owner = apache
listen.group = apache

Edit php.conf

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.old
vi /etc/httpd/conf.d/php.conf

Add


    	ProxySet disablereuse=off



	SetHandler proxy:fcgi://php-fpm


AddType text/html .php

DirectoryIndex index.php


	SetHandler application/x-httpd-php-source

Restart Apache/php-fpm

systemctl restart httpd
systemctl restart php-fpm

Method 2

Here is php-fpm config using proxy_fcgi

https://gist.github.com/serverok/3d2e43bb951ded9a42ce8bc0c2c3b627

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *