Possible bug: Upgraded Debian 8 to 9 - PHP7 now uses PHP5 settings

Discussion in 'Installation/Configuration' started by Jemt, Feb 18, 2020.

  1. Jemt

    Jemt Member HowtoForge Supporter

    I upgraded from Debian 8 to Debian 9 and installed PHP 7.0
    Now, when I create new websites, it runs on PHP 7, but uses a configuration file from PHP 5.

    Obviously this is referenced in the Fast CGI wrapper:

    But this puzzles me. Websites created prior to my upgrade had individual PHP configurations like shown below (highlighted):

    After upgrading to Debian 9 I added PHP 7 under Additional PHP versions so I could upgrade existing websites from PHP 5 to 7. Perhaps this is what's causing the bug/feature ?

    So, there are two problems here:
    New websites default to PHP 7 (great!), but they run on a PHP 5 configuration (first problem), and it's even a global / shared configuration, rather than individual configurations like prior to the upgrade (second problem).

    I'm running the most recent stable version of ISPConfig 3.

    How do I make it work like prior to the upgrade, so that websites have individual PHP configurations that is based on a configuration suitable for the given version of PHP.

    - Thanks for any help in advance. I'd be happy to supply additional information on request.

    Last edited: Feb 18, 2020
  2. Steini86

    Steini86 Active Member

    Consider directly upgrading to Debian 10 while you are at it. It is definitely stable now.
    If you care for speed change to php-fpm. Chances are good that this will solve your other problems, too.
    FPM is the fastcgi process manager, that takes care that every user runs its own processes and configurations.
    (Have you tried to do a resync of the webpages (tools -> resync))
  3. mbsouth

    mbsouth Member

    Hi Jemt

    On my current Debian 10.2:
    Path to the PHP FastCGI Binary: php-cgi7.0
  4. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    This is correct for an additional php version, though incorrect for the default php version in Debian 10; you should ensure all your /etc/alternatives/*php* are pointing to 7.3 versions, and update the PHP Settings under Server Config to those as well. Then resync all websites.
  5. mbsouth

    mbsouth Member

    Of course, the standard php version in Debian 10 is PHP 7.3.
    I have additional php versions installed (7.0 - 7.4).

    My note related to Jemt's question and his attitudes to additional php 7.0 version (see the screenshot above in the post).
    In Jemt's example the path to the PHP FastCGI Binary should be php-cgi7.0 and the Path to the php.ini directory should point to /etc/php/7.0/cgi/php.ini or did I misunderstand something?

    Last edited: Feb 19, 2020
  6. Jemt

    Jemt Member HowtoForge Supporter

    Hi guys.
    I apologize for my late reply - something came up.
    I really appreciate your help. I will be looking into your answers today and see if I can figure out how to solve this.
    Thanks :)
  7. Jemt

    Jemt Member HowtoForge Supporter

    Okay, turns out I was mistaken in regards to the PHPRC variable in the FastCGI wrapper.
    A website always points to the global/shared configuration, unless you add custom PHP settings under Sites > youdomain > Options > Custom php.ini settings. In that case a website specific PHP.ini file is created, and the PHPRC variable pointed to that file. Makes perfect sense.
    Regarding the problem with PHP 7 running on the PHP 5 configuration when selecting "Default" under "PHP Version", the only good solution I have been able to find, is to change the default PHP intepreter from PHP 7 to PHP 5, which is also what the article that @mbsouth linked to suggests (well, actually the article says: The default PHP of the operating system has to remain at the original version).
    I think this is really a problem with ISPConfig not adapting to the default PHP version (@till ?), making sure to set PHPRC to a PHP configuration compatible with the default PHP intepreter on the system. But obviously having PHP 5 as the default is much better than defaulting to PHP 7.x running with a potentially outdated and incompatible PHP 5 configuration.
    Also, please note that the screenshot with my PHP 7.0 configuration is wrong! It points Path to the PHP FastCGI binary to /usr/bin/php-cgi which is not correct. /usr/bin/php-cgi is a symlink to /etc/alternatives/php-cgi which in turn is a symlink to the default PHP version on the system, which can be changed with update-alternatives --config php-cgi as described in the article that @mbsouth linked to (rememer to also run update-alternatives --config php - otherwise the default PHP binary is not updated, only the default FastCGI binary). So, the correct value for Path to the PHP FastCGI binary in my PHP 7.0 configuration would be: /usr/bin/php-cgi7.0

    Thanks guys for all you help. Especially the article from @mbsouth was an eye opener. Thank you so much :)

    Best regards
    Last edited: Feb 23, 2020
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The default PHP configuration is set in ISPConfig under System > Server config > PHP. All you have to do after a system upgrade is to change the values there to use the new default PHP version of the new operating system version, that's all.
    Jemt likes this.
  9. Jemt

    Jemt Member HowtoForge Supporter

    Oh, I see. Thanks a lot @till - I apologize for pointing fingers :)
  10. Jemt

    Jemt Member HowtoForge Supporter

    @till , it seems that changing the PHP settings under System > Server Config > MY SERVER > Web > PHP Settings
    does not affect existing sites configured with PHP Version = Default.
    I even tried the Resync tool and chose to resync all services.
    All websites still run on the old PHP configuration (uses the php.ini from PHP5 rather than the one from PHP7.3)

    Notice how PHPRC still points to PHP5 in the FastCGI wrapper:


    Is this by design? Do I need to manually go through all the websites and update the PHP version to get it to use the most recent PHP version's configuration file ?

    - Thanks
  11. Jemt

    Jemt Member HowtoForge Supporter

    Also, it puzzles me how ISPConfig picked up on PHP 7.0.
    The control panel seems to be running on the php.ini file for PHP 7.0 - even though PHP 7.3 has now been set under PHP Settings.

  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Verify you have set OS default PHP version for both command line and web use to the original OS default. With command update-alternatives.
    Jemt likes this.
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    That's correct, this setting is used when a site is added or changed. Just a guess, did the affected websites use FastCGI mode and you missed adjusting the fastcgi settings on fastcgi tab?

    The settings under System > server config is for websites only. The control panel itself gets configured by the installer.
  14. Jemt

    Jemt Member HowtoForge Supporter

    @till , thank you for your help again. I appreciate your help so I took this opportunity to once again become a HowToForge Supporter.

    To be honest, I don't remember for sure whether I accidentially misconfigured FastCGI for one of the alternative PHP versions at some point. They are all properly configured now though. But would it have made any difference? You stated that the settings are only used when created/updating sites. So I don't see how it should have made any difference on existing sites. The FastCGI wrapper in the last screenshot I posted is a faily old website which was indeed created when the server was running PHP 5. I just expected to be able to somehow upgrade all websites set to be using PHP Version "Default", just by changing the PHP Settings under Server Config and doing a resync. If that is not already possible, it sounds like a good feature request :)

    I see. Is there some way I can make it use the new PHP version by running the installer/update script again?
    Running `ispconfig_update.sh` just returns: There are no updates available for ISPConfig 3.1.15p3
    Or is it safe to modify the FastCGI wrapper for ISPConfig by hand, simply replacing
    (naturally I have PHP 7.3 installed)
    till likes this.
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    An ISPConfig update with reconfigure services = yes is required after a distribution upgrade as this will update the config files with settings specific to the new OS version. You can also modify the wrapper by hand if you prefer that.
    Jemt likes this.
  16. Jemt

    Jemt Member HowtoForge Supporter

    So since ispconfig_update.sh does not work when I have the most recent version, I should download and run the ISPConfig installer instead, once I have carried throug a dist-upgrade, to make sure everything works as expected? Or should I take it a step further, and complete the entire installation guide for Debian 10 ? The last two times I upgraded Debian (Debian 7 => Debian 8 => Debian 9), I didn't go through the installation guides for ISPConfig - I only performed a regular dist upgrade as described in the release notes for Debian.
  17. Steini86

    Steini86 Active Member

    cd /tmp
    wget https://www.ispconfig.org/downloads/ISPConfig-3.1.15p3.tar.gz
    tar xvfz ISPConfig-3.1.15p3.tar.gz
    cd ispconfig3_install/install
    php -q update.php
    Sometimes new packages are needed with new versions. Go through the guide and execute the "apt install" commands to make sure you have all the needed software installed (only of the components you want/need, obviously).
    For example, very old versions for example did not use/install php-fpm, which is the standard nowadays. To get full advantage of new features, new software packages need to be installed. This is not done by an upgrade, you have to take care of that yourself. If everything is working I would not blindly install packages, just have a look which is installed and if there are some missing. Then think about that package, what it does and if you need it.
    Jemt likes this.
  18. Jemt

    Jemt Member HowtoForge Supporter

    Last edited: Feb 25, 2020
    Steini86 likes this.

Share This Page