Install PHP 5.6 as and additional version on Ubuntu 18.04

Discussion in 'Installation/Configuration' started by Fafa24, Jul 31, 2018.

  1. Fafa24

    Fafa24 Member

    Hello,

    We have the latest ISPconfig 3.1 with PHP 7.2.5 on Ubuntu 18.04 installed. We would like to install an additional older PHP version 5.6 for customer website which required the older PHP version.

    I have seen this tutorial "How to install PHP 5.6 as additional PHP-FPM & FastCGI for ISPConfig 3.1 on Ubuntu 16.04"

    First - does this tutorial also work with Ubuntu 18.04? In that tutorial there are various options to configure PHP. When I did this I got config errors. To fix it I removed the options from configure, but not sure it was a good idea.

    Thanks,
    Edy
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  3. Fafa24

    Fafa24 Member

    Thanks - A tutorial for 18.04 would be perfect or a hint what change is necessary for 18.04 vs 16.10. I like the idea to have a lower version of PHP as addition in ISPconfig. The other option would be to configure a server with PHP 5.6.
     
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    And we normally don't configure a server to lower version (php5.6), especially when default for Ubuntu 18.04 is php7.2.
     
    Last edited: Aug 1, 2018
    ztk.me likes this.
  5. Fafa24

    Fafa24 Member

    thanks for the commands - This means I would need to change default to php5.6 in order to use it. Right?
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    No, do not change default PHP. ISPConfig most likely stops working if you do that.
    ISPConfig can handle multiple PHP versions per website, so you can use the PHP version you want for each website. But ISPConfig needs the PHP version that comes with the OS distribution.
     
  7. Fafa24

    Fafa24 Member

    Okay thanks - good to know
     
  8. Dennis_sp

    Dennis_sp Member

    Hi, i tried to install pHP 5.6 on my Ubuntu 18 server according to post #4. I think it's almost working but i'm getting a 500 error for my website and see this in the log:

    fcgid:warn] [pid 21723] (104)Connection reset by peer: [client ********:59746] mod_fcgid: error reading data from FastCGI server
    End of script output before headers: index.php

    In ISPConfig>System>tab FastCGI settings:

    Path to the PHP FastCGI binary: /etc/php/5.6/cgi
    Path to the php.ini directory: /etc/php/5.6/cli

    PHP-FPM Settings tab:

    Path to the PHP-FPM init script: php-fpm5.6
    Path to the php.ini directory: /etc/php/5.6/cli
    Path to the PHP-FPM pool directory: /etc/php/5.6/fpm/pool.d

    I tried to use this guide as example:
    https://www.howtoforge.com/tutorial/how-to-install-php-5-6-on-ubuntu-16-04/

    But it's for a different Ubuntu and PHP version.
     
  9. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    That path is to a directory, not a binary.
     
  10. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    That is the wrong directory for the fpm mode php.ini.
     
  11. Dennis_sp

    Dennis_sp Member

  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I would follow the configurations I wrote in #2.
     
  13. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    You said you followed the tutorial to make and install php5 manually but you didn't follow the path it uses (/opt), that is why you failed.

    Please take note that the manual method of make and install any php version is no longer advisable nor preferable as the preferred method is via using Ondrej Sury ppa and way of installing it is prescribed in his php launchpad / ppa page:
    Code:
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    
    @Taleman already mentioned this above.
     
  14. Dennis_sp

    Dennis_sp Member

    @Taleman - i will try your method too, thanks
    @ahrasis - Actually i didn't follow that method completely. I did these steps from your post:
    add-apt-repository ppa:eek:ndrej/php
    apt install -y 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-imagick php5.6-curl php5.6-intl php5.6-memcache php5.6-memcached php5.6-ps php5.6-pspell php5.6-recode php5.6-snmp php5.6-sqlite php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-mbstring php5.6-fpm

    And then i used the other guide to look how i should ad the feature for the PHP version the web gui.
    Also i didn't do apt update && apt -y upgrade because the first time i did that some things got broken but i assume that is because during the upgrade process i chose to keep my own modified php.ini files where i should have chosen to replace them.

    So that's why i have no path in /opt. I used your steps in post #4 and then the other guide for the gui steps.
     
  15. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    When setting up ppa repository, updating it to use the latest is a must to me but I don't see that as the main cause of your errors when running php5.6. Perhaps the site using php5.6 error logs can help you more in troubleshooting.
     
  16. Dennis_sp

    Dennis_sp Member

    I finally had time again to try and get PHP 5.6 working. I followed the above steps to the letter without any errors this time. But i still get a 500 error when viewing my PHP 5.6 site and in the logs i still see the same error:

    Connection reset by peer mod_fcgid: error reading data from FastCGI server

    update: fixed by adding this line:
    FcgidBusyTimeout 3600
    to /var/www/conf/<webdir>/php.ini
     
    Last edited: Apr 9, 2021
    ahrasis likes this.

Share This Page