[SOLVED] Update php version in ISPConfig after upgrade to Debian 9

Discussion in 'General' started by gscaglia, Aug 30, 2017.

  1. gscaglia

    gscaglia Member HowtoForge Supporter

    Hi there,
    I've upgrade my servers to DEbian 9 Stretch and the php versions in the servers are now two: 5.6.30 and 7.0.19.
    If I put php -v the result is of course this: PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS )...
    But on ISPConfig 3 -> Servers Config -> Web -> Php settings there are again the PHP 5 informations and the WordPress sites on the servers work with the old PHP version.
    What's the best way to change the PHP settings on ISPConfig 3 and change the PHP versionon the web sites WordPress present?
    Thanks a lot
     
  2. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    Wordpress works fine with php 7. At least all my sites do... For the change afaik you need to do it manually.
     
  3. gscaglia

    gscaglia Member HowtoForge Supporter

    That's just what I was afraid of!!!:confused:
    The PHP settings for PHP 5, on my ISPConfig panel, are these:
    Apache php.ini path /etc/php5/apache2/php.ini
    CGI php.ini path /etc/php5/cgi/php.ini
    PHP-FPM init script php5-fpm
    PHP-FPM php.ini path /etc/php5/fpm/php.ini
    PHP-FPM pool directory /etc/php5/fpm/pool.d
    PHP-FPM start port 9010
    PHP-FPM socket directory /var/lib/php5-fpm
    PHP open_basedir [website_path]/web:
    [website_path]/private:
    [website_path]/tmp:/var/www/
    [website_domain]/web:/srv/www/
    [website_domain]/web:/usr/share/php5:
    /usr/share/php:/tmp:/usr/share/phpmyadmin:
    /etc/phpmyadmin:/var/lib/phpmyadmin
    Check php.ini every X
    minutes for changes 1 0 = no check​

    If I change the PHP settings for PHP 7 like these I think it's right (Debian 9), please confirm it!
    Apache php.ini path /etc/php/7.0/apache2/php.ini
    CGI php.ini path /etc/php/7.0/cgi/php.ini
    PHP-FPM init script php7.0-fpm
    PHP-FPM php.ini path /etc/php/7.0/fpm/php.ini
    PHP-FPM pool directory /etc/php/7.0/fpm/pool.d
    PHP-FPM start port 9010
    Check php.ini every X
    minutes for changes 1 0 = no check
    But what may I put in these fields?

    PHP-FPM socket directory ???
    PHP open_basedir [website_path]/web:
    [website_path]/private:
    [website_path]/tmp:/var/www/
    [website_domain]/web:/srv/www/
    [website_domain]/web:/usr/share/???:
    /usr/share/php:/tmp:/usr/share/phpmyadmin:
    /etc/phpmyadmin:/var/lib/phpmyadmin​

    I'm sorry but I wouldn't like nothing surprise on the servers in production.
    Thanks a very lot!
     
  4. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    I had trouble with php7 on Debian 9 as well. @till sent me the correct settings a few days ago. Here they are:
    [​IMG]
    So your settings are correct. The missing ones are in the screenshot. Hope this help.
     
    gscaglia likes this.
  5. gscaglia

    gscaglia Member HowtoForge Supporter

    Thanks!!!
    May you copy and paste the "PHP open_basedir" parameters that do not see them all from the image, please?
    Because in the middle there is this "[website_domain]/web:/usr/share/php5:" which worries me very much!:)
     
  6. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    From the VM of the Perfect Setup:
    [website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
     
    gscaglia likes this.
  7. gscaglia

    gscaglia Member HowtoForge Supporter

    Thank you very much!!!
     
  8. wisp

    wisp New Member

    any chance that sceenshot or the fields could get reposted, I have the same situation.
     
  9. Mr. Goose

    Mr. Goose New Member

    Last edited: Apr 15, 2020
  10. Mr. Goose

    Mr. Goose New Member

    Okay I finally got PHP7 working. Here's how I did it. I had already done the Debian Jessie to Stretch upgrade exactly as described here, and rebooted:-
    Everything seemed OK until I noticed that all my sites managed by ISPConfig were still running PHP 5.6.x. However, I also noticed that PHPMyAdmin was running PHP7. So I tried making the changes detailed by @gscaglia earlier in this thread, but they did nothing. The sites still ran 5.6, How could this be? Then I noticed that some of the paths quoted in @gscaglia 's earlier post did not exist on my system, specifically:
    • /etc/php/7.0/fpm/php.ini
    • /etc/php/7.0/cgi/php.ini
    Transpires that the upgrade from Debian 8 to Debian 9 did not install all the necessary php components. You need to make sure that the current Debian default version of php has all the necessary parts installed. To fix this run the following as root:-
    • apt install php-fpm php-cgi php-imagick
    (php-magick isn't strictly necessary but if you run Wordpress, it may complain that it's missing)

    Then from within ISPConfig, navigate your way to the web settings. It requires quite a bit of clicking around the page, but basically they are located at:- ,
    • System > Server Config [select your server] > Web tab > PHP settings
    Once I was there, I made the following changes only:-
    • Apache php.ini path: /etc/php/7.0/apache2/php.ini
    • CGI php.ini path: /etc/php/7.0/cgi/php.ini
    • PHP-FPM init script: php7.0-fpm
    • PHP-FPM php.ini path: /etc/php/7.0/fpm/php.ini
    • PHP-FPM pool directory: /etc/php/7.0/fpm/pool.d
    On the FastCGI tab, I made this change only:-
    • FastCGI php.ini Path: /etc/php/7.0/cgi/php.ini
    And hey presto, all my sites now run PHP 7.0.x!
    Final note, I am NOT an ISPConfig expert. So hopefully someone far more knowledgeable than I will look over this post and make any amendments and/or corrections they feel necessary. But this worked for me and I thought I should share it with the community. I hope it helps someone.
     
  11. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    After upgrading the OS, you should then walk through the Perfect Server tutorial for the new OS version (debian 9 in this case) and run all the commands to install software (this would have gotten your missing php packages), and make any other changes as needed (eg. when updating to Debian 10 you might find yourself uninstalling roundcube and phpmyadmin packages, and installing from sources per that tutorial). After that, download the ISPConfig installation sources and run update.php again, and let it reconfigure services.

    Note: you should still do all this on your installation if you have not, even if you don't see any issues right now.

    One other suggestion I'd make is to install additional php versions from the sury.org repositories; you can then set your websites to use the specific php version they might need, and not receive a surprise php upgrade just because you upgraded your server.
     

Share This Page