2

I need some help on Apache2 not loading the php-fpm php.ini. I have installed php-fpm successfully, created the pool and other configurations but Apache2 doesn't change the Server API from Apache 2.0 Handler to FPM/FastCGI

fastcgi.conf in Apache2

Action php-fcgi-tccuat-72 /php-fcgi-john-72
Alias /php-fcgi-tccuat-72 /usr/lib/cgi-bin/php-fcgi-john-72
FastCgiExternalServer /usr/lib/cgi-bin/php-fcgi-john-72 -socket /run/php-fpm-www-john-72.sock -idle-timeout 360 -pass-header Authorization
...
<Directory /usr/lib/cgi-bin>
        Options ExecCGI FollowSymLinks
        SetHandler fastcgi-script
        Require all granted
</Directory>

then added a line to my vhost entry:

...
 AddHandler php-fcgi-john-72 .php
...

Status of PHP-FPM

systemctl status php7.2-fpm
● php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-07-07 08:05:22 NZST; 16min ago
     Docs: man:php-fpm7.2(8)
  Process: 923 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.2/fpm/pool.d/www.co
 Main PID: 854 (php-fpm7.2)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/php7.2-fpm.service
           ├─854 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)                      
           ├─911 php-fpm: pool www-default-72                                                 
           ├─912 php-fpm: pool www-john-pub-72                                              
           ├─913 php-fpm: pool www-john-72                                                  
           ├─918 php-fpm: pool www                                                            
           └─922 php-fpm: pool www      

PHP Info:

PHP Version 7.2.31-1+ubuntu16.04.1+deb.sury.org+1


----------


System: Linux ansible3rd 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64
Build Date: May 14 2020 08:27:14
Server API: Apache 2.0 Handler
Virtual Directory Support: disabled
Configuration File (php.ini) Path: /etc/php/7.2/apache2
Loaded Configuration File: /etc/php/7.2/apache2/php.ini
Scan this dir for additional .ini files: /etc/php/7.2/apache2/conf.d 

What I am expecting is:

Server API: FPM/FastCGI
Virtual Directory Support: disabled
Configuration File (php.ini) Path: /etc/php/7.2/fpm
Loaded Configuration File: /etc/php/7.2/fpm/php.ini
Scan this dir for additional .ini files: /etc/php/7.2/fpm/conf.d 

Did I miss something?

camilox
  • 23
  • 4

1 Answers1

2

Make sure you don't have libapache2-mod-php installed. Apache is reporting that it is using this module instead of php-fpm.

sudo apt purge libapache2-mod-php

Then restart httpd.

sudo systemctl restart apache2
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • hi.. i don't have that installed. ```apt purge libapache2-mod-php Reading package lists... Done Building dependency tree Reading state information... Done Package 'libapache2-mod-php' is not installed, so not removed The following package was automatically installed and is no longer required: snapd-login-service Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 83 not upgraded. ``` – camilox Jul 06 '20 at 21:16
  • @camilox You still need to restart the web server. – Michael Hampton Jul 06 '20 at 21:17
  • yes i did. both php7.2-fpm and apache2.. nothing happens. – camilox Jul 06 '20 at 21:17
  • 1
    @camilox Are you sure you don't have mod_php installed? Probably under a different package name, or manually installed. Try `apt list installed | grep mod.php` – Michael Hampton Jul 06 '20 at 21:18
  • yep. 100% did not install it. i install this `libapache2-mod-fastcgi` – camilox Jul 06 '20 at 21:22
  • you're right.. actually resolved my issue. i just need add 7.2 at the end coz i was using custom php pakcage. so i `apt remove libapache2-mod-php7.2` and restarted both php7.2-fpm and apache2, and it works now. thank you very much. – camilox Jul 06 '20 at 21:30