PHP Startup: Unable to load dynamic library 'memcache.so'

Discussion in 'ISPConfig 3 Priority Support' started by Jemt, Aug 4, 2023.

  1. Jemt

    Jemt Member HowtoForge Supporter

    Hi.
    When I execute the ispconfig_update.sh script, or simply do php -v, I suddenly get the warning below:

    Code:
    PHP Warning:  PHP Startup: Unable to load dynamic library 'memcache.so' (tried: /usr/lib/php/20180731/memcache.so (/usr/lib/php/20180731/memcache.so: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/memcache.so.so (/usr/lib/php/20180731/memcache.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP 7.3.33-11+0~20230612.108+debian10~1.gbp1f186d (cli) (built: Jun 12 2023 06:32:26) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.3.33-11+0~20230612.108+debian10~1.gbp1f186d, Copyright (c) 1999-2018, by Zend Technologies
    This server started out as a Debian 7.0 server and was installed by following this guide:
    https://www.howtoforge.com/perfect-server-debian-wheezy-apache2-bind-dovecot-ispconfig-3
    It has since been upgraded following the official guides, and is now running Debian 10.
    At some point I installed multiple versions of PHP as described in this guide:
    https://www.howtoforge.com/ispconfig-php-debian/

    I can see that the Debian 7 guide instructed me to install memcache, while the guide describing how to install multiple versions of PHP did not, which is probably why they are not found on my system. But I'm surprised to suddenly see these warnings now - I have not seen them before.

    Here is a dump of what memcache packages are installed, and what memcache packages are available :

    upload_2023-8-4_18-40-49.png

    How can I best resolve this problem? Can I simply issue the following command, assuming I have PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, and 8.2 installed ?

    Code:
    apt-get install -y php5.6-memcache php5.6-memcached php7.0-memcache php7.0-memcached php7.1-memcache php7.1-memcached php7.2-memcache php7.2-memcached php7.3-memcache php7.3-memcached php7.4-memcache php7.4-memcached php8.0-memcache php8.0-memcached php8.1-memcache php8.1-memcached php8.2-memcache php8.2-memcached
    Perhaps consider updating the PHP guide (https://www.howtoforge.com/ispconfig-php-debian/) to include the installation of the memcache extensions if this is indeed the best solution.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    They are not needed and, therefore not part of that guide. You get the error because you have configured it in a PHP.ini include, while this extension is not there anymore. So the correct fix is to find out where you load that file:

    grep -R memcache.so /etc/php

    and then remove this include file which loads memcache.so
     
  3. Jemt

    Jemt Member HowtoForge Supporter

    Thanks for your reply, @till.

    I don't believe I have made any such changes or additions to the system. I'm pretty sure I only use configuration shipping with Debian
    packages and ISPConfig.

    I did upgrade all packages today (apt-get upgrade). Perhaps that caused the error.

    This is the output of grep -R memcache.so /etc/php --- including broken symlinks :-/

    upload_2023-8-4_19-44-22.png

    I'm using https://sury.org/ for PHP packages - this is the content of /etc/apt/sources.list.d/php.list:
    deb https://packages.sury.org/php/ buster main

    Perhaps this is actually a dependency bug in the repository ?!
     
    Last edited: Aug 4, 2023
  4. Jemt

    Jemt Member HowtoForge Supporter

    I just tried `apt-get install php7.3-memcache` just to realize that it will remove php-memcache.
    If I do `apt-cache show php-memcache` it reveals that this package provides php7.3-memcache. So it should be installed.
    I also made sure the CLI is using php7.3 which it does.
    upload_2023-8-4_20-55-13.png
     
  5. Jemt

    Jemt Member HowtoForge Supporter

    Code:
    root@isp:~# php --ini
    PHP Warning:  PHP Startup: Unable to load dynamic library 'memcache.so' (tried: /usr/lib/php/20180731/memcache.so (/usr/lib/php/20180731/memcache.so: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/memcache.so.so (/usr/lib/php/20180731/memcache.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    Configuration File (php.ini) Path: /etc/php/7.3/cli
    Loaded Configuration File:         /etc/php/7.3/cli/php.ini
    It's also the correct configuration files being loaded for the command line.
     
  6. Jemt

    Jemt Member HowtoForge Supporter

    It seems memcache.so is installed in a different folder than the one PHP attempts to load it from.
    memcache.so is located here:
    upload_2023-8-4_21-8-8.png

    And according to the warning, the module is expected to be found in /usr/lib/php/20180731/

    I'm not sure how to change that, and why it should even be necessary for me to do this by hand. Seems like an installation/upgrade procedure should have taken care of this.
     
    Last edited: Aug 4, 2023
  7. Jemt

    Jemt Member HowtoForge Supporter

    @till I wonder if this can be caused by ISPConfig overwriting PHP configuration files, removing extension_dir (?).
    Something is off. I believe all I have done is following the guides and keeping the system up to date using `apt-get upgrade`. I'm not sure whether the problem lies in the packages or ISPConfig. Naturally I can't rule out that I made a mistake myself - but I really don't tinker much with this server.
     
    Last edited: Aug 4, 2023
  8. Jemt

    Jemt Member HowtoForge Supporter

    I have just tested with all the versions of PHP installed on the command line (PHP 5, 7.0, 7.3, 7.4, 8.0, 8.1, 8.2). All of them, except for php 7.3, works as expected. Only 7.3 complains about the missing memcache module.
     
    Last edited: Aug 4, 2023
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig is not overwriting any PHP configuration files.

    ISPConfig is not related to this and ISPConfig does not require this extension for itself, that's why you do not have any issues even when the extension is not there, except that PHP notifies you about this fact.

    The problem is that you do not have the memcache.so file for the PHP version you are using. None of the .so files you have is in the wrong folder, they are just for different or older PHP versions. As I suggested, either remove the memcache ini file which loads the not installed extension, or you can install the memcache package for PHP 7.3 and see if it resolved this.
     
  10. Jemt

    Jemt Member HowtoForge Supporter

  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Perhaps memcache package was removed but it's configuration files remain?
    Code:
    dpkg --list | grep -i memcache
    If there are lines that start with rc it means removed but configuration files remain. If you apt remove those with --purge, it should remove the configuration files. Maybe this removes the references to memcache in your php ini and modules files.
     
    Jemt likes this.

Share This Page