• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved PHP FPM stuck on OS vendor version

RDrake

New Pleskian
Server operating system version
Ubuntu 18.04.6 LTS
Plesk version and microupdate number
18.0.49
Symptom: I try to set tht PHP handler of a website in Domain settings to PHP 8.1 FPM. When I open up the phpinfo() of this website it says:

PHP Version 7.2.24-0ubuntu0.18.04.16​

Configuration File (php.ini) Path/etc/php/7.2/cgi
Loaded Configuration File/etc/php/7.2/cgi/php.ini

The domain config is listed in /opt/plesk/php/8.1/etc/php-fpm.d/, however it still falls back to PHP 7.2 CGI, but why?
I tried:
Code:
# plesk repair web -php-handlers -php-fpm-configuration
But it had no effect.

The PHP 8.1 FPM handler seems to be up and running:
Code:
plesk-php81-fpm.service - The PHP 8.1.16 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/plesk-php81-fpm.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/plesk-php81-fpm.service.d
└─limit_nofile.conf, respawn.conf
Active: active (running) since Thu 2023-02-23 04:04:43 CET; 2 days ago
Main PID: 31357 (php-fpm)
Status: "Processes active: 0, idle: 0, Requests: 1, slow: 0, Traffic: 0req/sec"
Tasks: 1 (limit: 105)
CGroup: /system.slice/plesk-php81-fpm.service
└─31357 php-fpm: master process (/opt/plesk/php/8.1/etc/php-fpm.conf)

Feb 23 04:04:42 h2891136.stratoserver.net systemd[1]: Starting The PHP 8.1.15 FastCGI Process Manager...
Feb 23 04:04:43 h2891136.stratoserver.net systemd[1]: Started The PHP 8.1.15 FastCGI Process Manager.
Feb 24 13:09:56 h2891136.stratoserver.net systemd[1]: Reloading The PHP 8.1.16 FastCGI Process Manager.
Feb 24 13:09:56 h2891136.stratoserver.net systemd[1]: Reloaded The PHP 8.1.16 FastCGI Process Manager.
Feb 25 17:39:33 h2891136.stratoserver.net systemd[1]: Reloading The PHP 8.1.16 FastCGI Process Manager.
Feb 25 17:39:33 h2891136.stratoserver.net systemd[1]: Reloaded The PHP 8.1.16 FastCGI Process Manager.
Feb 25 17:59:21 h2891136.stratoserver.net systemd[1]: Reloading The PHP 8.1.16 FastCGI Process Manager.
Feb 25 17:59:21 h2891136.stratoserver.net systemd[1]: Reloaded The PHP 8.1.16 FastCGI Process Manager.

Does anyone know what is going on here? I'm quite out of ideas how to better track this down.

Don't know if this helps, but here is the PHP handler list:
Code:
# plesk bin php_handler --list
id:        display name:  full version:  version:    type:                         cgi-bin:                    php-cli:                        php.ini:  custom:  status:
                        cgi  7.2.24 by OS vendor         7.2.24       7.2      cgi                 /usr/bin/php-cgi                /usr/bin/php        /etc/php/7.2/cgi/php.ini    false disabled
                    fastcgi  7.2.24 by OS vendor         7.2.24       7.2  fastcgi                 /usr/bin/php-cgi                /usr/bin/php        /etc/php/7.2/cgi/php.ini    false disabled
                        fpm  7.2.24 by OS vendor         7.2.24       7.2      fpm             /usr/sbin/php-fpm7.2                /usr/bin/php        /etc/php/7.2/fpm/php.ini    false disabled
                     module  7.2.24 by OS vendor         7.2.24       7.2   module                 /usr/bin/php-cgi                /usr/bin/php    /etc/php/7.2/apache2/php.ini    false disabled
            plesk-php81-cgi               8.1.16         8.1.16       8.1      cgi   /opt/plesk/php/8.1/bin/php-cgi  /opt/plesk/php/8.1/bin/php  /opt/plesk/php/8.1/etc/php.ini     true disabled
        plesk-php81-fastcgi               8.1.16         8.1.16       8.1  fastcgi   /opt/plesk/php/8.1/bin/php-cgi  /opt/plesk/php/8.1/bin/php  /opt/plesk/php/8.1/etc/php.ini     true  enabled
            plesk-php81-fpm               8.1.16         8.1.16       8.1      fpm  /opt/plesk/php/8.1/sbin/php-fpm  /opt/plesk/php/8.1/bin/php  /opt/plesk/php/8.1/etc/php.ini     true  enabled
  plesk-php81-fpm-dedicated               8.1.16         8.1.16       8.1      fpm  /opt/plesk/php/8.1/sbin/php-fpm  /opt/plesk/php/8.1/bin/php  /opt/plesk/php/8.1/etc/php.ini     true enabled
 
a) Does the file /etc/php/7.2/cgi/php.ini exist?
b) Does the file /opt/plesk/php/8.1/etc/php-fpm.d/<domainname>.conf exist?

if (a), please switch the PHP handler selection to any different version, click "OK", then switch it back to the desired 8.1. version.
Then test again.

If (b), please do a syntax check on both webservers
Code:
# apachectl -t
# nginx -t
and - if the check returns no errors - reload both.
Code:
# service httpd reload
# service nginx reload
Then test again.
 
a) php.ini exists in
/etc/php/7.2/cgi/
:
73K Jan 2 2022 php.ini
--> changed the PHP Handler to 7.4FPM, then back to 8.1FPM
--> Same result, phpinfo still says
PHP Version 7.2.24-0ubuntu0.18.04.16

b) yes, the .conf file for the domain in question exists in the directory
/opt/plesk/php/8.1/etc/php-fpm.d/

I don't have nginx installed.
Code:
apachectl -t
Syntax OK

Code:
service httpd reload
httpd: unrecognized service
service apache2 reload

--> waited for apache2 to reload
--> Same result, phpinfo still says
PHP Version 7.2.24-0ubuntu0.18.04.16
 
So far I have never seen a situation where changing of PHP versions and reload the web server still used a wrong PHP version.

Two checks that need to be done from here:

a) Please verify that the domain name that you configure is pointing to the host where you are working on. If the above toggle and restart of the webserver does not solve the issue there is a chance that you are configuring a wrong host. For that reason you don't experience the effect of a configuration change.

b) Let's test if the hypothesis (a) is correct: Please try to switch the PHP handler to "FastCGI" instead of "FPM". This should change the web server configuration files in /var/www/vhosts/system/<domainname>/conf, please also verifiy that these are changed.

Before the change:
Code:
                <Directory /var/www/vhosts/<subscription>/<domainname>>

                        <IfModule mod_fcgid.c>
                                <Files ~ (\.fcgi$)>
                                        SetHandler fcgid-script
                                        Options +ExecCGI
                                </Files>
                        </IfModule>
                        <IfModule mod_proxy_fcgi.c>
                                <Files ~ (\.php$)>
                                        SetHandler proxy:unix:/var/www/vhosts/system/<domainname>/php-fpm.sock|fcgi://127.0.0.1:9000
                                </Files>
                        </IfModule>

                        SSLRequireSSL

                        Options +Includes -ExecCGI

                </Directory>
After the change:
Code:
                <IfModule mod_fcgid.c>
                        FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/<domainname>/etc/php.ini
                        FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php74-fastcgi
                        FcgidMaxRequestLen 134217728
                </IfModule>

                <Directory /var/www/vhosts/<subscription>/<domainname>>

                        <IfModule mod_fcgid.c>
                                <Files ~ (\.fcgi$)>
                                        SetHandler fcgid-script
                                        Options +ExecCGI
                                </Files>
                        </IfModule>
                        <IfModule mod_fcgid.c>
                                <Files ~ (\.php$)>
                                        SetHandler fcgid-script
                                        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
                                        Options +ExecCGI
                                </Files>
                        </IfModule>

                        SSLRequireSSL

                        Options +Includes -ExecCGI

                </Directory>
Do you see that change? Then restart the web server please one more time. If the issue persist after this change, solution (a) is correct.
 
Before the change
Code:
<Directory /var/www/vhosts/<mydomain>/httpdocs>

                        <IfModule mod_fcgid.c>
                                <Files ~ (\.fcgi$)>
                                        SetHandler fcgid-script
                                        Options +ExecCGI
                                </Files>
                        </IfModule>
                        <IfModule mod_proxy_fcgi.c>
                                <Files ~ (\.php$)>
                                        SetHandler proxy:unix:/var/www/vhosts/system/<mydomain>/php-fpm.sock|fcgi://127.0.0.1:9000
                                </Files>
                        </IfModule>

                        SSLRequireSSL

                        Options -Includes -ExecCGI

                </Directory>

After the change:
PHPInfo:
PHP Version 8.1.16
Configuration File (php.ini) Path /opt/plesk/php/8.1/etc
Loaded Configuration File /var/www/vhosts/system/<mydomain>/etc/php.ini

Http config:
Code:
<IfModule mod_fcgid.c>
      FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/<mydomain>/etc/php.ini
                        FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php81-fastcgi
                        FcgidMaxRequestLen 134217728
                </IfModule>

                <Directory /var/www/vhosts/<mydomain>/httpdocs>

                        <IfModule mod_fcgid.c>
                                <Files ~ (\.fcgi$)>
                                        SetHandler fcgid-script
                                        Options +ExecCGI
                                </Files>
                        </IfModule>
                        <IfModule mod_fcgid.c>
                                <Files ~ (\.php$)>
                                        SetHandler fcgid-script
                                        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
                                        Options +ExecCGI
                                </Files>
                        </IfModule>

                        SSLRequireSSL

                        Options -Includes -ExecCGI

                </Directory>

Should I prepare to comission a new VPS ... ?
 
As it works with direct FastCGI calls, everything seems to be right with Plesk and with PHP. The only remaining question is now why a PHP-FPM call is not responded to by the configured PHP version, but the operating system version. My only idea for that is that on the operating system level, a symbolic link has been created that is redirecting something, e.g. a socket file or the PHP binary or something. You are not using Cloud Linux, so in my opinion there is not much else that could be the reason for this behavior. Was it ever tried on this system to change the "operating system" PHP to another version by manipulating symbolic links?

Anyway, two options: Yes, you could try to setup a new server with a fresh operating system. Or you could open a support ticket, hand an engineer this thread so that she/he can see what's already been tried, and try to find the root cause. Support engineers are really good at Plesk, they'll probably figure it out.
 
Hm ... using fastCGI instead of PHP FPM might be a makeshift solution. But it would be best if I could repair the FPM ....
 
Hm ... I wouldn't know where to start to look for changes on the symbolic links?
You mean: tries to start FPM ... but really starts the system PHP version?
 
Oh dear .... I figured it out :rolleyes:
Your last message made me crawl into my memory ... and then I found it: I set up additional apache-directives some years ago %)

Code:
    <Files ~ (\.php$)>
        SetHandler fcgid-script
        Options +ExecCGI
        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
    </Files>

Probably hard to figure out ://

But then again I found the error thanks to your help! So thank you a whole lot! =D
 
Back
Top