1
votes

I installed apache2.4 and php-fpm, but I still have php5-cgi processing my requests, althought php-fpm process is running.

Here is what I did :

apt-get install php5-fpm
apt-get install libapache2-mod-fastcgi
a2enmod actions

Edit /etc/apache2/mods-available/fastcgi.conf like that :

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header  Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>

service apache2 restart

But now if I run phpinfo() I get :

Server API  CGI/FastCGI

instead of FPM/FastCGI

2

2 Answers

1
votes

Ok I finally found why php fpm wasn't used : I needed to enable it in my vhost files. Edit :

/etc/apache2/sites-enabled/domain.conf

remove :

AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php

add :

ProxyPassMatch ^/(.*.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi://localhost/home/domain/domains/domain/public_html/$1
0
votes

another try:

Install the Apache Worker MPM (Multi-Procesing Modules)

sudo apt-get install apache2-mpm-worker
sudo apt-get install libapache2-mod-fastcgi php5-fpm php5
sudo apt-get update

and again:

sudo apt-get install libapache2-mod-fastcgi php5-fpm php5

sudo a2enmod actions fastcgi alias

restart apache

sudo service apache2 restart

then sudo nano /etc/apache2/conf.d/php5-fpm.conf and paste that in:

<IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
    <Directory /usr/lib/cgi-bin>
        Require all granted 
    </Directory>
    #directory statement mult be on multiple lines
</IfModule>

then :

sudo service apache2 restart

and that should work