Wrong PHP pool

Discussion in 'Installation/Configuration' started by dtamajon, Oct 3, 2020.

  1. dtamajon

    dtamajon New Member

    Hi,
    I'm using ISPConfig with multiple PHP versions. I have configured the pool path of each PHP version like "/etc/php/{version}/fpm/pool.d/", for example "/etc/php/7.3/fpm/pool.d/" for PHP 7.3.
    When I create a website and the webN.conf file is generated, it is done on "/etc/php/7.3/fpm/", so the configuration is not loaded and I cannot use the {FASTCGIPASS} on nginx directives, as generated port is no available to be used.

    That happens only when I select a custom PHP version. If I use the "Default" option on PHP version, the file is stored properly.

    I guess I'm missing something in my configuration. I appreciate any help!


    My environment is
    Debian 10
    ISPConfig 3.1.15p3
    Nginx
    PHP 7.2 / 7.3 / 7.4
     
    Last edited: Oct 3, 2020
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    how did you configure the pool path? did you do this in the php.ini file? in the control panel, system - server config - <server> - web - php section?
    or did you set it in the system - additional php versions section of the control panel?
    it needs to be done in the last one. you need to set:
    Code:
    in fastcgi settings tab:
    Path to the PHP FastCGI binary: /usr/bin/php-cgi7.3
    Path to the php.ini directory: /etc/php/7.3/cgi
    
    Code:
    in php-fpm settings tab:
    Path to the PHP-FPM init script: /etc/init.d/php7.3-fpm
    Path to the php.ini directory: /etc/php/7.3/fpm
    Path to the PHP-FPM pool directory: /etc/php/7.3/fpm/pool.d
    
    you need to add it individually for each server (set server in the name tab, along with user friendly identifier for the php name. client can be left blank)

    for any other versions of php, just set it all exactly the same, apart from changing the 7.3 to whatever is the correct version number for the php you are currently adding[/code]
     
    Last edited: Oct 5, 2020
  3. dtamajon

    dtamajon New Member

    I have configured it on "System > Additional PHP Versions" for each PHP version and each PHP version has its own configuration.

    See my config here:
    [​IMG]

    FastCGI settings for PHP 7.2:
    [​IMG]

    PHP-FPM settings for PHP 7.2:
    [​IMG]

    FastCGI settings for PHP 7.3:
    [​IMG]

    PHP-FPM settings for PHP 7.3:
    [​IMG]

    FastCGI settings for PHP 7.4:
    [​IMG]

    PHP-FPM settings for PHP 7.4:
    [​IMG]


    All the paths exists, and all FPM services are up and running.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Just to be sure, you tested with a phpinfo() file that the wrong PHP version is used after you switched PHP version and waited until the red dot in the navbar in ispconfig is gone, right? We had users in the past that looked into the vhost config file and thought that they use the wrong php version because of numbers like 7.3 in paths, but the php version is not used in any path, which means you can't see in a vhost file which PHP version is in use.
     
  5. dtamajon

    dtamajon New Member

    Hi, I have waited until configuration is up-to-date on ISPConfig. With the configuration I showed previously, where should the webN.conf generated? For PHP 7.4, for example, as per my configuration, should be genetared on "/etc/php/7.4/fpm/pool.d/", but they are not... instead I can find the web1.conf, web2.conf, etc files on "/etc/php/7.4/fpm/"

    NOTE: I will refer to port 9012 because is the one used at the example I put... I know a new port is generated for each site and it is not a fixed one... I used that just for example purposes.

    Taking as example my web3 site, the web3.conf is as follows:

    [web3]

    listen = 127.0.0.1:9012
    listen.allowed_clients = 127.0.0.1

    user = web3
    group = client2

    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/client2/web3/tmp
    env[TMPDIR] = /var/www/clients/client2/web3/tmp
    env[TEMP] = /var/www/clients/client2/web3/tmp
    env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

    php_admin_value[open_basedir] = /var/www/clients/client2/web3/web:/var/www/clients/client2/web3/private:/var/www/clients/client2/web3/tmp:/var/www/test.mysite.com/web$
    php_admin_value[session.save_path] = /var/www/clients/client2/web3/tmp
    php_admin_value[upload_tmp_dir] = /var/www/clients/client2/web3/tmp
    php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f [email protected]"

    php_admin_value[extension] = curl.so
    php_admin_value[suhosin.memory_limit] = 1024M
    php_admin_value[memory_limit] = 1024M
    php_admin_value[post_max_size] = 64M
    php_admin_value[upload_max_filesize] = 64M


    The generated nginx vhost file is using the port 9012, as defined on web3.conf, but I get an error 502 Bad Gateway on trying to browse the site. If I force the port to my known PHP port, then it works properly.

    After some digging, the problem is exactly that: web3.conf is in the wrong directory. If I move manually the "/etc/php/7.4/fpm/web3.conf" file to "/etc/php/7.4/fpm/pool.d/web3.conf" and restart the PHP-FPM service, then the generated port 9012 is working properly. Why? Because now web3.conf is in the correct path to be loaded by PHP!
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

  7. dtamajon

    dtamajon New Member

    This is the result. No errors shown and no try to write into pool.d:

    05.10.2020-13:10 - DEBUG - Calling function 'check_phpini_changes' from plugin 'webserver_plugin' raised by action 'server_plugins_loaded'.
    05.10.2020-13:10 - DEBUG - Found 1 changes, starting update process.
    05.10.2020-13:10 - DEBUG - Calling function 'ssl' from plugin 'nginx_plugin' raised by event 'web_domain_update'.
    05.10.2020-13:10 - DEBUG - Calling function 'update' from plugin 'nginx_plugin' raised by event 'web_domain_update'.
    05.10.2020-13:10 - DEBUG - safe_exec cmd: chattr -i '/var/www/clients/client4/web6' - return code: 0
    05.10.2020-13:10 - DEBUG - safe_exec cmd: chattr +i '/var/www/clients/client4/web6' - return code: 0
    05.10.2020-13:10 - DEBUG - safe_exec cmd: df -T '/var/www/clients/client4/web6'|awk 'END{print $2,$NF}' - return code: 0
    05.10.2020-13:10 - DEBUG - safe_exec cmd: which 'setquota' 2> /dev/null - return code: 0
    05.10.2020-13:10 - DEBUG - safe_exec cmd: setquota -u 'web6' '0' '0' 0 0 -a &> /dev/null - return code: 0
    setquota: Not setting block grace time on /dev/mapper/web-www because softlimit is not exceeded.
    setquota: Not setting inode grace time on /dev/mapper/web-www because softlimit is not exceeded.
    05.10.2020-13:10 - DEBUG - safe_exec cmd: setquota -T -u 'web6' 604800 604800 -a &> /dev/null - return code: 0
    05.10.2020-13:10 - DEBUG - safe_exec cmd: chattr +i '/var/www/clients/client4/web6' - return code: 0
    05.10.2020-13:10 - DEBUG - Enable SSL for: test.mydomain.com
    05.10.2020-13:10 - DEBUG - Writing the vhost file: /etc/nginx/sites-available/test.mydomain.com.vhost
    05.10.2020-13:10 - DEBUG - Writing the PHP-FPM config file: /etc/php/7.2/fpm/web6.conf
    05.10.2020-13:10 - DEBUG - Calling function 'restartPHP_FPM' from module 'web_module'.
    sh: 1: Syntax error: ")" unexpected
    05.10.2020-13:10 - DEBUG - Restarting php-fpm: systemctl reload 9072).service
    05.10.2020-13:10 - DEBUG - nginx status is: running
    05.10.2020-13:10 - DEBUG - Calling function 'restartHttpd' from module 'web_module'.
    05.10.2020-13:10 - DEBUG - Checking nginx configuration...
    05.10.2020-13:10 - DEBUG - nginx configuration ok!
    05.10.2020-13:10 - DEBUG - Restarting httpd: systemctl restart nginx.service
    05.10.2020-13:10 - DEBUG - nginx restart return value is: 0
    05.10.2020-13:10 - DEBUG - nginx online status after restart is: running
    05.10.2020-13:10 - DEBUG - Processed datalog_id 175
    05.10.2020-13:10 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
     
    Last edited: Oct 5, 2020
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    When you change the PHP version in the ISPConfig GUI and press save, then go back to the website settings, does the new PHP version shows up, or does it display the old version again?

    And are you logged in as admin user, reseller, or as client or use the login as client function?
     
  9. dtamajon

    dtamajon New Member

    I have found the error!!
    You cannot use the character ")" in your PHP name! After I have removed the character, it is working properly.

    Thank you for your guide for debugging!
     
  10. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    @dtamajon, I'm not able to reproduce a problem on 3.2 with apache, this is probably resolved with changes in how php versions are stored.
     

Share This Page