• 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 Can't set PHP7 as FPM Application served by Nginx, it switches back to php5

Chuy Sanchez

New Pleskian
Hello.

I'm using Plesk 12.5 on a CentOS 6 server.

I'm trying to set my server to use PHP7 as FPM application served by Nginx. PHP7 works when I set it as Fastcgi apache module. But when I change it to php-fpm nginx, it switches php version back to php5.

I've tried to use the script to reread handlers but it didn't work.
plesk bin php_handler --reread

Any advice would be appreciated.
 
Could you please show me output of the following command:

# plesk sbin php_handlers_control —list

Also make sure that you have Apache version 2.4 but not 2.2
 
Output:
Code:
                id:  display name:  version:    type:                         cgi-bin:                    cli-bin:                        php.ini:  system:         service:                           pool.d:
    plesk-php70-fpm          7.0.3     7.0.3      fpm  /opt/plesk/php/7.0/sbin/php-fpm  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini        *  plesk-php70-fpm  /opt/plesk/php/7.0/etc/php-fpm.d
    plesk-php70-cgi          7.0.3     7.0.3      cgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini        *                                                  
            fastcgi         5.4.13    5.4.13  fastcgi                 /usr/bin/php-cgi                /usr/bin/php                    /etc/php.ini        *                                                  
             module         5.4.13    5.4.13   module                 /usr/bin/php-cgi                /usr/bin/php                    /etc/php.ini        *                                                  
                cgi         5.4.13    5.4.13      cgi                 /usr/bin/php-cgi                /usr/bin/php                    /etc/php.ini        *                                                  
plesk-php70-fastcgi          7.0.3     7.0.3  fastcgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini        *

Also, the installed version of apache is 2.2. But I need nginx as web server, not apache. Is it still mandatory to install apache 2.4? And if it's required, is there a safe way to install it via plesk update or something like that? Or i have to do it manually?

Thanks.
 
Dear Igor!
Thanks to your work here, a have learned a lot from it. Im a hungarian hosting provider, but i can't solve this issue too.
Here's the facts:
Debian 7.11
Apache/2.2.22 (Debian)
nginx/1.11.1
Code:
id:                display name:        version:    type:                         cgi-bin:                    cli-bin:                        php.ini:  system:    service:                           pool.d:
plesk-php70-cgi            7.0.8     7.0.8      cgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini        *                                         
plesk-php56-fastcgi        5.6.23    5.6.23  fastcgi   /opt/plesk/php/5.6/bin/php-cgi  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini       *                                         
cgi                        5.4.45    5.4.45      cgi                /usr/bin/php5-cgi               /usr/bin/php5           /etc/php5/cgi/php.ini       *                                         
module                    5.4.45    5.4.45   module                /usr/bin/php5-cgi               /usr/bin/php5       /etc/php5/apache2/php.ini       *                                         
fastcgi                    5.4.45    5.4.45  fastcgi                /usr/bin/php5-cgi               /usr/bin/php5           /etc/php5/cgi/php.ini       *                                         
fpm                        5.4.45    5.4.45      fpm               /usr/sbin/php5-fpm               /usr/bin/php5           /etc/php5/fpm/php.ini       *    php5-fpm /etc/php5/fpm/pool.d
plesk-php70-fpm          7.0.8     7.0.8      fpm  /opt/plesk/php/7.0/sbin/php-fpm  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini       *  plesk-php70-fpm /opt/plesk/php/7.0/etc/php-fpm.d
plesk-php56-cgi         5.6.23    5.6.23      cgi   /opt/plesk/php/5.6/bin/php-cgi  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini       *                                         
plesk-php56-fpm         5.6.23    5.6.23      fpm  /opt/plesk/php/5.6/sbin/php-fpm  /opt/plesk/php/5.6/bin/php  /opt/plesk/php/5.6/etc/php.ini       *  plesk-php56-fpm  /opt/plesk/php/5.6/etc/php-fpm.d
plesk-php70-fastcgi        7.0.8     7.0.8  fastcgi   /opt/plesk/php/7.0/bin/php-cgi  /opt/plesk/php/7.0/bin/php  /opt/plesk/php/7.0/etc/php.ini        *

How can i set the fastcgi_pass by the nginx to use the php7 not the OS (5.4.45) version for a certain domain?

Thanks.
 
cgi 5.4.45 5.4.45 cgi /usr/bin/php5-cgi /usr/bin/php5 /etc/php5/cgi/php.ini * module 5.4.45 5.4.45 module /usr/bin/php5-cgi /usr/bin/php5 /etc/php5/apache2/php.ini * fastcgi 5.4.45 5.4.45 fastcgi /usr/bin/php5-cgi /usr/bin/php5 /etc/php5/cgi/php.ini * fpm 5.4.45 5.4.45 fpm /usr/sbin/php5-fpm /usr/bin/php5 /etc/php5/fpm/php.ini * php5-fpm /etc/php5/fpm/pool.d

As you can see, your VENDOR PHP - version is PHP 5.4.45 on Debian. You could for example use the often used ( and very well supported ) repository from "Ondřej Surý" and replace version 5.4.45 with PHP 5.6 or PHP 7.0 ( now as well 7.1 ).

A nice tutorial can be found at:

Installing PHP 5.6.x and 7.0.x with Ubuntu 14.04 and Virtualmin 5.0gpl using a PPA ( external link, pls. inform me, if the link goes dead, so I can provide another working link )
 
As you can see, your VENDOR PHP - version is PHP 5.4.45 on Debian. You could for example use the often used ( and very well supported ) repository from "Ondřej Surý" and replace version 5.4.45 with PHP 5.6 or PHP 7.0 ( now as well 7.1 ).
Thanks, i know this way, but if plesk can maintane multiple PHP versions, it has to be a solution to use: etc. php 7 on one domain with nginx. Idont prefer to use one PHP version on the whole system.

This could be a good starting pont to this, maybe... >>> http://marcelog.github.io/articles/configure_nginx_php_5.3_5.2_fastcgi.html ( external link, pls. inform me, if the link goes dead, so I can provide another working link )
 
but if plesk can maintane multiple PHP versions, it has to be a solution to use: etc. php 7 on one domain with nginx
Also, the installed version of apache is 2.2. But I need nginx as web server, not apache. Is it still mandatory to install apache 2.4? And if it's required, is there a safe way to install it via plesk update or something like that? Or i have to do it manually?

You can vote for this feature: https://plesk.uservoice.com/forums/...s/suggestions/4123981-add-nginx-only-hostings

... and pls. note as well the Plesk - Admin comment:
Current scope for Plesk Onyx is to enable an ability to serve all http(s) requests by Nginx only.

Note: apache will still be installed. Switching of apache to optional component is subject for the next release.
 
Hi Adam Dobruczky,

you may create what ever you wish to on your server, but I would rather consider to solve your issue with the domain - specific socket, as for example:

Code:
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_pass "unix:/var/www/vhosts/system/YOUR-DOMAIN.COM/php-fpm.sock";
        fastcgi_index index.php;

        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        include /etc/nginx/fastcgi.conf;
 
Thanks for your answer, but this problem i still have it on all of my servers!

A attached an image, no matter what php version (5.6 or 7) i choose with the nginx+FPM the websites still use the OS vendor PHP version, what is 5.4.4. 2.jpg
I have spent days to solve this, but i cant, somehow all websites use the same pool /var/run/php-fpm.sock wich point to the OS PHP.

Here is my handlers:
3.jpg

How can is use Nginx + FPM width PHP7?
 
Hi Adam Dobruczky,

pls. consider to open your own thread, due to the fact, that the threadstarter uses a different OS than you on his server. Pls. consider as well to include depending errors/issues/problems from your psa - log - file(s) in your new thread, which may be existent, when you change the PHP - handler over your Plesk Control Panel. In addition, consider to investigate errors/issues/problems at your dependind PHP-FPM - log - files ( vendor AND Plesk - PHP-FPM - related log - files, pls. )
 
Thanks i made a new thread.

Hi Adam Dobruczky,

pls. consider to open your own thread, due to the fact, that the threadstarter uses a different OS than you on his server. Pls. consider as well to include depending errors/issues/problems from your psa - log - file(s) in your new thread, which may be existent, when you change the PHP - handler over your Plesk Control Panel. In addition, consider to investigate errors/issues/problems at your dependind PHP-FPM - log - files ( vendor AND Plesk - PHP-FPM - related log - files, pls. )
 
Back
Top