Php 5.6 Error Unable to connect to MySQL

Discussion in 'HOWTO-Related Questions' started by scorpious, Aug 2, 2018.

  1. scorpious

    scorpious Member

    Hi All

    I followed the How to install PHP 7.1, 7.2 and 5.6 as PHP-FPM & FastCGI for ISPConfig 3 on Debian 9

    When I set the Php version to 5.6 I get the follow errors

    Php 5.6 fast-cgi Unable to connect to MySQL
    Php 5.6 PHP-FPM ERROR 503 - Service Unavailable!

    When I set the Php version to Php 7.1 or Php 7.2 the both are working and I can connect to the Mysql Server

    When I view PHP settings using phpinfo()
    I see PHP Version 5.6.33

    When I test Php with
    <?php
    echo "Hello World!";
    ?>
    It works ok

    What could be causing this?

    Cheers
    Scorp
     
  2. scorpious

    scorpious Member

    Hi
    Any tips for the above problem ?
     
  3. Taleman

    Taleman Active Member HowtoForge Supporter

    Check you have installed php mysql module also for PHP 5.6.
     
  4. scorpious

    scorpious Member

    Hi Taleman
    Which is the best way to check to see if I have installed php mysql module also for PHP 5.6.
    When I view the phpinfo this is what I get
    Php 5.6
    Configuration File (php.ini) Path /opt/php-5.6/lib
    Loaded Configuration File /opt/php-5.6/lib/php.ini
    Scan this dir for additional .ini files (none)

    PHP Version 7.0.30
    Configuration File (php.ini) Path /etc/php/7.0/cgi
    Loaded Configuration File /etc/php/7.0/cgi/php.ini
    Scan this dir for additional .ini files /etc/php/7.0/cgi/conf.d
    Below is the info from the phpinfo
    mysqli
    MysqlI Support enabled
    Client API library version mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
    Active Persistent Links 0
    Inactive Persistent Links 0
    Active Links 0

    Directive Local Value Master Value
    mysqli.allow_local_infile On On
    mysqli.allow_persistent On On
    mysqli.default_host no value no value
    mysqli.default_port 3306 3306
    mysqli.default_pw no value no value
    mysqli.default_socket no value no value
    mysqli.default_user no value no value
    mysqli.max_links Unlimited Unlimited
    mysqli.max_persistent Unlimited Unlimited
    mysqli.reconnect Off Off
    mysqli.rollback_on_cached_plink Off Off

    Cheers
    Scorp
     
    Last edited: Aug 9, 2018
  5. Taleman

    Taleman Active Member HowtoForge Supporter

    Find out what the Debian package name is. I think it is php5.6-mysql. Then do
    Code:
    apt-cache policy php5.6-mysql
     
  6. scorpious

    scorpious Member

    Hi Taleman
    this is what I see when I run the command
    apt-cache policy php5.6-mysql
    N: Unable to locate package php5.6-mysql
    N: Couldn't find any package by glob 'php5.6-mysql'
    N: Couldn't find any package by regex 'php5.6-mysql'

    Cheers
    Scorp
     
  7. Taleman

    Taleman Active Member HowtoForge Supporter

    That is strange. On my Debian 9.5 Stretch it returns:
    Show what this command returns on your setup:
     
  8. scorpious

    scorpious Member

    Hi Taleman
    lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description: Debian GNU/Linux 9.5 (stretch)
    Release: 9.5
    Codename: stretch

    When I change the php to 7.1 or 7.2 or even leave it at the Default everything is working ok, its only when I want to use Php 5.6 I get the connection error
    Cheers
    Scorp
     
  9. Taleman

    Taleman Active Member HowtoForge Supporter

  10. scorpious

    scorpious Member

    Hi Taleman
    Cheers for the advise i will look at the other way

    Scorp
     

Share This Page