Fatal error: Class 'mysqli' not found

Discussion in 'General' started by glardone, Jun 29, 2017.

  1. glardone

    glardone New Member

    Hi,
    if I try to update my ISPconfig to latest version, I get this error:
    Fatal error: Class 'mysqli' not found in /tmp/update_stable.sh.3y4mxDiAkY/ispconfig3_install/install/lib/mysql.lib.php on line 31

    I think it is caused by coexistence of two PHP version (5 and 7): I need it to be able to deliver the hosting with the PHP version required by the customers.
    Any idea to resolve this issue?
    Thank you!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Install the PHP mysqli package. You can have multiple php versions, that's not a problem.
     
  3. glardone

    glardone New Member

    Hi,
    I tried: first I have checked which version of PHP is running:

    php -v
    PHP 5.6.30 (cli) (built: Apr 27 2017 16:39:18)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies​


    but I get this error:

    apt-get install php5-mysqli
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package php5-mysqli is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    php5-mysqlnd:i386 php5-mysql:i386 php5-mysqlnd php5-mysql

    E: Package 'php5-mysqli' has no installation candidate​

    Any idea?
    Tnx!
     
  4. ahrasis

    ahrasis Active Member

    What is your distro? Is php5 come together with it by default or are you using ondrej multi php ppa or did you build php5?
     
  5. glardone

    glardone New Member

    My distro is Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-123-generic x86_64)
    I build the two php version in these directories:
    /usr/local/src/php5-build/php-5.6.30
    /usr/local/src/php5-build/php-7.0.18
     
  6. ahrasis

    ahrasis Active Member

    Then rebuild it with mysqli instead of using apt-get install.
     
  7. glardone

    glardone New Member

  8. till

    till Super Moderator Staff Member ISPConfig Developer

    are you sure that the manually build PHP is the one that is used for cli? The way php is built in the tutorial you mebtioned activates it only for websites in ispconfig, it does not activate it as main php.

    Please post the output of:

    which php

    maybe you replaced the system php with a custom one as well.
     
  9. glardone

    glardone New Member

    which php
    /usr/local/bin/php
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, seems as if you have overriden the main php, possibly with a failed compile attempt. Please try this:

    mv /usr/local/bin/php /usr/local/bin/php_bak

    and then try to run the ISPConfig update again.
     
  11. glardone

    glardone New Member

    Fantastic! This work!
    Thank you very much for support.
    Best regards.
     
  12. Olgierd

    Olgierd Member

    Hi,
    I have similar problem. Looks like cli does not have msqli so I can't update ispconfig.
    It could happend when I add php 5.6 and php 7, but cli is using php 5.4 and I did not touch it.
    Main php ins not changed on my debian 7.
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you try what I suggested above and that helped glardone?
     
  14. Olgierd

    Olgierd Member

    Yes I tried but php is not working than at all, because there is no php file in the folder
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    /usr/local/bin/php is always a self compiled PHP, the system PHP is /usr/bin/php. So either you removed the system PHP or your system PHP has no mysqli extension installed, the mysqli extension of the system php can be installed with apt or yum
     
  16. Olgierd

    Olgierd Member

    /usr/bin/php links to /usr/bin/php5 is still there. I can run php script from cli but with out mysqli.
    I was able to do update to ispconfig 3.1.4 but when I added php 5.6 and php 7 something is worng with cli.
    I can run mysqli calls in php 5.4 using mod_php, fastcgi etc. by apache.
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Please run:

    php --version

    on the shell and post the output.
     
  18. Olgierd

    Olgierd Member

    PHP 5.6.0 (cli) (built: Jun 25 2017 16:42:08)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
     

Share This Page