Debian 9 - Different versions of PHP-FPM for different websites

Discussion in 'Installation/Configuration' started by PVasileff, Dec 9, 2017.

  1. PVasileff

    PVasileff Member

    Hi.
    I have configured Debian 9 Perfect Server and I want to use PHP FPM for 5.6, 7.0, 7.1 and 7.2 installed from this HowTo
    on tcp port. Can you you provide me a workaround to do this? I want to use different versions of PHP-FPM for different websites. Is it possible? My current ISPConfig version is 3.1.9

    Aditional PHP version was added on System > Additional PHP Versions. For example PHP 7.1:
    ==
    FastCGI settings:
    -
    Path to the PHP FastCGI binary: /usr/bin/php-cgi7.1
    Path to the php.ini directory: /etc/php/7.1/cgi

    ==
    PHP-FPM settings:
    -
    Path to the PHP-FPM init script: /usr/sbin/php-fpm7.1
    Path to the php.ini directory: /etc/php/7.1/fpm
    Path to the PHP-FPM pool directory: /etc/php/7.1/fpm/pool.d


    Default PHP-FPM work on tcp port 9011 but it is for PHP 7.0.
    When I try to set PHP-FPM and PHP 7.1 in error log file I get error:

    PHP:
    [Sat Dec 09 12:56:55.810379 2017] [proxy_fcgi:error] [pid 14466] [client 11.22.33.44:52254AH01079failed to make connection to backendhttpd-UDS
    [Sat Dec 09 12:57:13.346779 2017] [proxy:error] [pid 14669] (111)Connection refusedAH00957FCGIattempt to connect to 127.0.0.1:9011 (*) failed
    So, in website settings when I set PHP-FPM and "Default" its work.

    But when I set PHP-FPM and select PHP 7.1 I got errror.
    I apologize and thank you for your time.
     
    Last edited: Dec 9, 2017
  2. PVasileff

    PVasileff Member

    I test to use and socket.
    I`ve change directory for socket in "System -> Server Config -> Web -> PHP Settings -> PHP-FPM socket directory" to:
    /run/php

    In website -> Options tab I check : Use Socket For PHP-FPM
    and select Domain tab and set PHP - PHP-FPM and version: Default

    in /run/php/ web2.sock is created and in this case work. My website work and use FPM via sock:
    Code:
    srw-rw---- 1 web2  www-data 0 Dec  9 14:53 /run/php/web2.sock
    Content of file: /etc/php/7.0/fpm/pool.d/web2.conf
    Code:
    [web2]
    
    listen = /run/php/web2.sock
    listen.owner = web2
    listen.group = www-data
    listen.mode = 0660
    
    user = web2
    group = client1
    
    pm = dynamic
    pm.max_children = 10
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 5
    pm.max_requests = 0
    
    chdir = /
    
    env[HOSTNAME] = $HOSTNAME
    env[TMP] = /var/www/clients/client1/web2/tmp
    env[TMPDIR] = /var/www/clients/client1/web2/tmp
    env[TEMP] = /var/www/clients/client1/web2/tmp
    env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    php_admin_value[open_basedir] = /var/www/clients/client1/web2/web:/var/www/clients/client1/web2/private:/var/www/clients/client1/web2/tmp:/var/www/mydomain.com/web:/srv/www/mydomain.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
    php_admin_value[session.save_path] = /var/www/clients/client1/web2/tmp
    php_admin_value[upload_tmp_dir] = /var/www/clients/client1/web2/tmp
    php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f [email protected]"
    


    But when I select another version (for example 7.1) the file /run/php/web2.sock was deleted by cron and doesnt recreate..

    and in error log I see:

    PHP:
    [Sat Dec 09 14:34:06.919290 2017] [proxy_fcgi:error] [pid 25637] [client 11.22.33.44:53920AH01079failed to make connection to backendhttpd-UDS
    [Sat Dec 09 14:34:08.729282 2017] [proxy:error] [pid 25640] (2)No such file or directoryAH02454FCGIattempt to connect to Unix domain socket /run/php/web2.sock (*) failed
     
    Last edited: Dec 9, 2017
  3. lnxgs

    lnxgs Member

    Hi, you should modify the port on /opt/php-7.0.0/etc/php-fpm.d/www.conf file; if you don't know where the file is, try to locate www.conf using:
    updatedb
    locate www.conf
     
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I used the following install script after installing ondrej ppa for making php5.6 to php7.2 available to all websites on my Ubuntu 16.04 Nginx server:
    Code:
    apt -y install software-properties-common
    add-apt-repository ppa:ondrej/php
    apt update && apt upgrade
    apt -y install php5.6-opcache php5.6-fpm php5.6 php5.6-common php5.6-gd php5.6-mysql php5.6-imap php5.6-cli php5.6-cgi php5.6-mcrypt php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php7.0-opcache php7.0-fpm php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-imap php7.0-cli php7.0-cgi php7.0-mcrypt php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-zip php7.0-mbstring php7.1-opcache php7.1-fpm php7.1 php7.1-common php7.1-gd php7.1-mysql php7.1-imap php7.1-cli php7.1-cgi php-pear php-auth php7.1-mcrypt mcrypt imagemagick libruby php7.1-curl php7.1-intl php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl php7.1-zip php7.1-mbstring memcached php-memcache php-imagick php-gettext php-apcu php7.2-opcache php7.2-fpm php7.2 php7.2-common php7.2-gd php7.2-mysql php7.2-imap php7.2-cli php7.2-cgi php7.2-curl php7.2-intl php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-zip php7.2-mbstring
    Setup in ISPConfig control panel is the same as in the tutorial.
     
    Last edited: Mar 12, 2018
  5. PVasileff

    PVasileff Member

    As default in php 7.0 all www.conf files :

    Code:
    root@srv: ~ $ ll /etc/php/*/fpm/pool.d/www.conf
    -rw-r--r-- 1 root root 18K Jul 11 15:15 /etc/php/5.6/fpm/pool.d/www.conf
    -rw-r--r-- 1 root root 19K Jul 11 15:19 /etc/php/7.0/fpm/pool.d/www.conf
    -rw-r--r-- 1 root root 19K Jul 11 16:32 /etc/php/7.1/fpm/pool.d/www.conf
    -rw-r--r-- 1 root root 19K Jul 11 15:19 /etc/php/7.2/fpm/pool.d/www.conf
    
    listen on sock:

    Code:
    root@srv: ~ $ cat /etc/php/*/fpm/pool.d/www.conf |grep "listen ="
    listen = /run/php/php5.6-fpm.sock
    listen = /run/php/php7.0-fpm.sock
    listen = /run/php/php7.1-fpm.sock
    listen = /run/php/php7.2-fpm.sock
    In default version PHP7.0 that coming with Debian 9 - This is default configuration and ISPConfig work with it.
    May be I make somthingw wrong.. but I dont think so.
    Before reply please - read a post. Any version work with fast-cgi.. there is no problem with it.

    In my case I have problem with FPM version different from 7.0 (Default)
     

Share This Page