PHP 5.6 additional version on Debian 9

Discussion in 'Installation/Configuration' started by ChuckSC, Oct 1, 2017.

  1. ChuckSC

    ChuckSC New Member

    Hello everyone,

    I'm looking at running PHP 5.6 for legacy reasons in addition to version 7.0 currently as default. My server is running on Debian 9 (Stretch) with ISPConfig 3.1.7.

    At this point if I understand well, this is still somewhat tricky due to compatibility issues so I could use your guidance. Here's where I'm at:
    1. mkdir /opt/php-5.6.31
    2. mkdir /usr/local/src/php5-build
    3. cd /usr/local/src/php5-build
    4. wget -O php-5.6.31.tar.bz2
    5. tar jxf php-5.6.31.tar.bz2
    6. cd php-5.6.31/
    7. apt-get install build-essential
    8. apt-get build-dep php7.0 (build-dep php5 does not work)
    9. apt-get install libfcgi-dev libfcgi0ldbl libjpeg-dev libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-dev
    10. cd /usr/include
    11. ln -s x86_64-linux-gnu/curl (needed to avoid curl not being found later)
    12. ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.agit
    13. cd /usr/local/src/php5-build/php-5.6.31
    14. ./configure --prefix=/opt/php-5.6.31 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm.
    15. make
    And that's where the process stops by spewing a long list of errors with Openssl, such as:
    Makefile:635: recipe for target 'ext/openssl/openssl.lo' failed
    make: *** [ext/openssl/openssl.lo] Error 1
    ... with many other errors all referring to Openssl.

    Please let me know if you have a solution to get PHP 5.6 properly running on Debian 9. Thanks in advance for your help!
  2. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

  3. ChuckSC

    ChuckSC New Member

    Thank you, HSorgYves.

    Apparently I was able to patch it properly and move on. Now "make" is blocking on the following:

    [...] -I/usr/include -g -O2 -fvisibility=hidden  -c /usr/local/src/php5-build/php-5.6.31/ext/phar/util.c -o ext/phar/util.lo
    /usr/local/src/php5-build/php-5.6.31/ext/phar/util.c: In function ‘phar_verify_signature’:
    /usr/local/src/php5-build/php-5.6.31/ext/phar/util.c:1534:15: error: storage size of ‘md_ctx’ isn’t known
        EVP_MD_CTX md_ctx;
    /usr/local/src/php5-build/php-5.6.31/ext/phar/util.c:1633:5: warning: implicit declaration of function ‘EVP_MD_CTX_cleanup’ [-Wimplicit-function-declaration]
    Makefile:1343: recipe for target 'ext/phar/util.lo' failed
    make: *** [ext/phar/util.lo] Error 1
    But apparently after some research this could also be linked to Openssl, can anyone confirm?

    Thanks again.
  4. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    The previous posted patch should have solved that:
    -            EVP_MD_CTX md_ctx;
    +            EVP_MD_CTX *md_ctx;
    -            EVP_MD_CTX_cleanup(&md_ctx);
    +            EVP_MD_CTX_destroy(md_ctx);
  5. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    ChuckSC likes this.
  6. ISPConfig Developer ISPConfig Developer

    indeed, I use that on some servers for old-as-f php scripts - some use even older ioncube protection ... no support from vendor ( orly ^^ ). works pretty well.

    If however your customer or whoever is using other php-version from default and has cronjobs setup, remember to either alter the path to php-cli binary or make the old default ( check other stuff running on your sys which might have issue with that )
    update-alternatives --config php
    ChuckSC likes this.
  7. tmpinsnty

    tmpinsnty Member

    I'm going to co-op this thread for my purposes. I have a feeling I'm going to have to upgrade to stretch for pci compliance since every hit I get is for a version not on jessie.
    I have php 5.6.0, php 5.6.33, and php 7.1.16 loaded on my server. I just want to make sure that I won't lose the php 5's.

    Would I only have to worry about the issue if I was building a new Stretch server and need php5 installed?
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    If you upgrade to Stretch PHP 5.6 is indeed lost until You install it yourself. I got PHP 5.6, 7.0 and 7.1 following this guide:
    Read also the comments, especially the comment by Jesse Norell.
    Also this:
    One more:
    till likes this.
  9. tmpinsnty

    tmpinsnty Member

Share This Page