Getting shared library error with php and mysql module on centos

8,289

Solution 1

You're missing the MySQL client libary, not the MySQL library itself. The error is complaining about: libmysqlclient.so.16

Try installing the mysql-libs package. If you've already installed it, try reinstalling. libmysqlclient.so.16 appears to be part of it.

Where did you get the MySQL packages from that failed to install? You might have to clean out some config files before everything works together again, since the newer versions of things might have overwritten older configs, and just reinstalling the older packages might not overwrite them.

Edit: Saw that you tagged it CentOS and removed my comment :)

Solution 2

Run

 ldconfig

This made the Dynamic Linker Run Time Bindings reread the

/etc/ld.so.conf.d

directory for new library directories.

Share:
8,289

Related videos on Youtube

JohnK
Author by

JohnK

Updated on September 18, 2022

Comments

  • JohnK
    JohnK over 1 year

    I first installed php5.5 and mysql5.6 then due to some pacakge problem i had to remove them and install php5.3 and mysql 5.1 from yum.

    I php is not detecting any extensions and giving me this error

    [root@ipserver etc]# php -m
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    [PHP Modules]
    

    I do have files in that directory and they have read permissions

    [root@ipserver etc]# php --ini
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      /etc/php.d/mysql.ini,
    /etc/php.d/mysqli.ini,
    /etc/php.d/pdo_mysql.ini
    

    EDIT:

    I tried copy only mysql.so file somewhere else and harcode in php.ini

    extension=/etc/mysql.so

    i get this

    PHP Warning:  PHP Startup: Unable to load dynamic library '/etc/mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      (none)
    
  • JohnK
    JohnK almost 11 years
    i tried but same error