PHP version working in one website and not in a copy of that website

Discussion in 'ISPConfig 3 Priority Support' started by miguelpinheiro, Mar 13, 2018.

  1. Hallo!

    I have 2 websites running exactly the same software (they are a copy of each other) and they are both running with letsencrypt certificate: the original (production site) and a testing site (copy of production), running PHP 5.4.45 under FASTCGI. I'm using Debian 8 and ISPConfig latest version. The only difference is the production site is also running under cloudflare and the test site not.

    I followed the guide: "How to install PHP 7.1, 7.2 and 5.6 as PHP-FPM & FastCGI for ISPConfig 3 on Debian 9" to install PHP 5.6.X in my server (Debian 8). Everything went smoothly.

    Then went to test the new version of PHP in the test site and it run without any problems: tried both, FASTCGI and PHP-FPM and they worked just fine. Then I went to switch the php version on the production site and got a critical error. I tried on both, FASTCGI and PHP-FPM.

    I event got this message: "Database connection error (2): Could not connect to MySQL.Database connection error (2): Could not connect to MySQL.Database connection error (2): Could not connect to MySQL.Database connection error (2): Could not connect to MySQL." I couldn't dig to much because I had to switch back to the old PHP version because the site was down.

    I don't understand how this is possible. Can it be because ISPConfig didn't store the configuration properly for the production site? What can I do?

    Thanks in advance.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    When I have had websites not working with the other PHP version, it has been because some needed PHP module is not installed. Compare the list of installed packages on the two servers.
    If you have shell access, use command line to connect to the database with the website user and password. This may give better error message on screen or in logfiles.
  3. Thanks for the suggestion, @Taleman. Both sites are running on the same server under the same ISPConfig.

    Despite I configured in ISPConfig the working website to use PHP 5.6, ISPConfig set it to PHP Default (which is also PHP 5.6).
    Now I made that change also on the production site (set it to Default PHP) and it works, witch makes me think that the custom installed PHP version is not working.
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  5. Thanks for sharing @Taleman.
    It seems the risk of using that procedure is that it changes the default php of the server and I'm afraid it is to risky as my server runs several production sites. Anyway I think if I compare the modules and configuration files, probably I will find out what's going on and why my compiled PHP 5.6 is not working.
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    It does indeed change the default PHP version, I believe installing a new PHP with apt-get makes it the default version. So the last one installed becomes the default. But the default can be changed with update-alternatives, and indeed must be changed to 7.0 for ISPConfig to work properly.
  7. Didn't know ISPConfig required PHP 7 to work properly. My default PHP is 5.6 and I didn't noticed any problems though. I will look soon into this. Cheers.
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    PHP 5.6 works also, at least in older Debian where the stock PHP is 5.6. I believe 5.6 would work for ISPConfig in Debian 9 Stretch also, but am not sure.
    But in Debian Stretch ISPConfig 3.1.11 does not work if default PHP is 7.1 or 7.2. In some other thread (yesterday?) Till wrote ISPConfig latest would work with PHP 7.1 IFF the operating system stock version is PHP 7.1. In Stretch the PHP is 7.0 so there ISPConfig does not work with 7.1 or 7.2.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    To clarify this: ISPConfig expects to find the PHP version that comes as default with that Linux distribution version or to be more precise, it expects to find a PHP version between >= 5.3 and <= 7.1 in the path and with the service name that the default PHP of that Linux distribution is using. So what matters here is not the actual version of PHP unless it is not 7.2, what matters are the paths for config files, socket directories and the name of the php-fpm service.
    miguelpinheiro likes this.

Share This Page