Lỗi wordpress mysql_connect headers and client library minor version mismatch năm 2024

Lately, one of our customers updated MySQL and rebuild PHP via custombuild. However, his website shows DirectAdmin: Headers and client library minor version mismatch.

As part of our Server Management Services, we assist our customers with several DirectAdmin queries.

Today, let us see how to solve this particular error.

DirectAdmin: Headers and client library minor version mismatch

Warning: mysql_connect() [function.mysql-connect]: /Headers and client library minor version mismatch/. /Headers:50157 Library:50511/

Here, PHP compiles with MySQL lower version, but it links a MySQL library of higher version family. This is the major cause of this error.

The root reason for this error is that PHP separates itself from the MySQL client libraries.

Hence, what happens (mainly on older compiles of Linux) is that people will compile PHP against a given build of the MySQL Client (an irrelevant version of MySQL) and not upgrade (in CentOS this package is mysqlclientXX).

In addition, this allows the package maintainer to support lower versions of MySQL.

Though a messy way to perform the task, it is the only way given how PHP and MySQL use different licensing.

In order to solve this, initially, we have to upgrade PHP to a version that complies with MySQL API library version or revert back mysql client libraries to API header version.

To do so, perform a cleanup in custombuild and rebuild PHP

cd /usr/local/DirectAdmin/custombuild

./build clean

./build php

The MySQLND solves the problem with the help of PHP’s own native driver (the ND), which does not rely on the MySQL Client.

It also complies with the version of PHP we use. This is a better solution all around. If for no other reason MySQLND is made to have PHP talk to MySQL.

We can install mysqlnd using the command:

sudo yum install php-mysqlnd

[Failed to resolve the error? We’d be happy to assist]

Conclusion

In short, this error can occur even after MySQL update and PHP rebuild via custombuild. Today, we saw an effective method our Support Techs employ in order to solve this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

Warning: mysql_connect() [function.mysql-connect]: Headers and client library minor version mismatch. Headers:50318 Library:50096 in /home/bunny/public_html/books/includes/functions/database.php on line 19

Fix

Added the following line to /var/cpanel/easy/apache/rawopts/all_php5 :

–with-mysqli=mysqlnd

  • joomla
  • MySQL

Hello my name is Rajiv Sharma and I am the founder of RESEARCH & ME_mechscinovate which is my creativity, innovations, research and designs based blog. •Engineer•Inventor•Researcher•Designer•Author• Education Designing a all new PhD. course although I have not a PhD. B.Eng. in Mechanical Aug 2010-Aug 2013, Punjab, India Diploma in Mechanical Engineering May 2007-May 2010, Punjab, India Experience Freelance Creative Engineer, Inventor, Researcher, Innovator & Designer 2008 – Present Machine optimization & maintenance Engineer Dec 2014 – Present, Ludhiana, India Lecturer in Mechanical Engineering August 2013 – 2014, Punjab, India

After having MySQL 5.6.17 published, some users complained about a warning thrown by their PHP applications :

PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50535 Library:50617

In fact, this could happen with any application linked to libmysqlclient18 in a certain version (php5-mysql from Dotdeb is linked to the 5.5.35 version from the stock Debian distribution) when connecting to a MySQL server in another version (5.6.17 in our case). The warning is thrown by libmysqlclient18 itself. And this is just a warning, there is no reason why any bad behavior would happen in that case.

Of course, I could build php5-mysql against the latest libmysqlclient18 (5.6.17), but it would lead to very bad issues, such as duplicate symbols or segfaults when PHP is loaded with other MySQL-linked modules from the stock Debian distribution (those are linked to libmysqlclient18 5.5.35). For example : mod_php5 + Apache + mod_auth_mysql would crash.

Tip to everyone: Plesk itself uses mysql. Dont fool around if you're not sure what you're doing! You might mess up your installation.

EDIT 7 june 2017: Do not follow up with code posted below here! If I find out the proper way I will post it! just messed up my server!

...which is the reason I'm starting this topic. I expect more people to have this issue so this should be a question & description. It's verbose so it's findable.

I thought I had taken all proscribed steps for updating mariaDB. For some reason I've got this warning popping up: mysql_connect(): Headers and client library minor version mismatch

You can check your versions by filtering "Client API" from the php info. php -i | grep "Client API" which gives me Client API version => 10.1.23-MariaDB Client API library version => 10.1.23-MariaDB Client API header version => 5.5.50-MariaDB So I suspect I forgot one step.

Your server can run without trouble with this warning, in other cases not. Best to solve it. For example, connecting Wordpress Jetpack will not working while this issue remains: you'll get a 520 error and a weird print "client_secret".

So: how to safely update this version?

BTW I'm on Centos 7

Last edited: Jun 7, 2017

  • 2

    So: how to safely update this version?
BTW I'm on Centos 7

I think that you need to upgrade php-mysql package. For example, when I disable mysqli module in /etc/php.d/mysqli.ini file I see:

# php -i | grep "Client API" Client API version => 5.5.52-MariaDB Client API version => 5.5.52-MariaDB

And:

# rpm -qf /usr/lib64/php/modules/mysqli.so php-mysql-5.4.16-42.el7.x86_64

  • 3

Hi Igor,

thanks for your answer. Indeed I need to update the php-mysql package. In this rather old thread upgrade php package it is said that "It will drop right into Plesk" after you update the php-mysql package. There are in fact many topics on this issue so I'm happy you didn't tell me to go read somewhere else But this 'it will fix itself' exactly what I'm worried about. I'll look into your suggestion and report back what I find.

  • 4

Ok so for the nooblars like me.....I'll (try to) write down that Igor means by that.

  1. disable the mysqli module by commenting out. See this thread. Put a semicolon before "extension...".
  2. Client API versions mentioned on php -i grep "Client API", but no more library or header versions mentioned. Two lines instead of four. (I posted three above)
  3. The rpm command with q and f options. q is for querying packages and f is for file. So I'm looking into the version of that module. Which is php-mysql-5.4.16.42.el7.x86_64

So far so good - only reading. Indeed, we need to update. But how to do this safely? Some thing that could go wrong, I suppose, is that after I update the php-mysql package plesk keeps a reference to a no longer existing older package. Which sort of brings me back to my original question

UFHH01

Guest
  • 5

Hi sjerp van wouden,

Indeed, we need to update. But how to do this safely?

The additional package "php-mysql-5.4.16.42.el7.x86_64" depends on your installed PHP version and is compiled exactly for this PHP version and it's configured dependencies ( => libmysqlclient18 ).

If you desire to get rid of your WARNING ( not an error, pls. note that! ), pls. consider to replace the extension with the "php-mysqlnd" version, which doesn't link to any libmysqlclient library.

  • 6

    ( not an error, pls. note that! )

Indeed it is not an error As I said, the server can keep rolling along just fine but in some cases the warning will cause trouble, such as connecting WP Jetpack.

So onto the next step: then replacing with mysqlnd . In a previous attempt at Plesk, this is exactly where it went wrong. I messed up plesk in the process of starting using mysqlnd. Idiots summary of mysqlnd: it's a one size fits all php-mysql package so it solves conflicts. . There's no documentation on mysqlnd at Plesk. I think I did not phrase my question clear enough. I saw how to enable mysqlnd for php? before. I didn't want to follow these steps because I wasn't sure whether this was safe. Again the reason for this worrying is that plesk itself depends on mysql.

So is this the safe way to start using mysqlnd in plesk?

you can yum remove php-mysql

before yum install php-mysqlnd

Then check for success via php -m | grep mysqlnd

Before using yum, I like to check relevant installs, in this case like so: yum list installed | grep sql tells me (again) about php-mysql.x86_64. But there's also plesk-php[56,70,71]-mysql.x86_64. So that's one of those things that cause my concern.

Do I need to tell plesk about this php-mysql -> php-mysqlnd transition?

BTW, maybe it would be nice to have a page on mysqlnd in the documentation.

Last edited: Jun 7, 2017

UFHH01

Guest
  • 7

Hi sjerp van wouden,

pls. don't mix ( additional! ) Plesk PHP versions ( and its extensions/modules ) , with your vendor PHP version ( and its extensions/modules ). No, "php-mysqlnd", is not shipped by Plesk, as you can see as well, when you use the command:

In former times, "php-mysqlnd" was not supported by Plesk and instead, "php-mysql" has to be used. But this dependency has been expanded to both versions. ( pls. see as well: => mysqlnd support for Plesk 11.5 ).

So is this the safe way to start using mysqlnd in plesk?

If Plesk declares something "to be supported", you can be sure, that it has been tested and therefore your question can be answered with: Yes!

  • 8

    Hi sjerp van wouden, If Plesk declares something "to be supported", you can be sure, that it has been tested and therefore your question can be answered with: Yes!

I have followed through the steps I had found. Warning would not go away. Service restart didn't make a difference so I thought, I'll just reboot the machine, that'll restart all. Now I've got 502s everywhere.

Aaarrghhhh....

I saw an error with an mysql table which was resolved through mysql_upgrade, as the system suggested. Yet 502s persist.

Ah yes, seems to be exactly the same problem as last time around. I find Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: no such file. When I thought: lets restart the apache. Which was what happened last time. Which was why I started this thread Damn I would really not like to reinstall plesk entirely.

Full drama from the apache:

[root@vps-284144-5452 ~]# service httpd restart Redirecting to /bin/systemctl restart httpd.service Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. [root@vps-284144-5452 ~]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2017-06-07 15:45:19 CEST; 14s ago Docs: man:httpd(8) man:apachectl(8) Process: 1121 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 1119 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 1119 (code=exited, status=1/FAILURE)

Jun 07 15:45:19 vps-284144-5452.hosted.at.hostnet.nl httpd[1119]: AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkin...l.conf: Jun 07 15:45:19 vps-284144-5452.hosted.at.hostnet.nl httpd[1119]: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such f...rectory Jun 07 15:45:19 vps-284144-5452.hosted.at.hostnet.nl kill[1121]: kill: cannot find process "" Hint: Some lines were ellipsized, use -l to show in full.

Last edited: Jun 7, 2017

UFHH01

Guest
  • 9

Hi sjerp van wouden,

pls. continue with the following commands:

Code:

plesk bin repair --restore-vhosts-permissions -v
plesk bin repair --update-vhosts-structure -v
plesk repair web -y -v

... and report back ( as well with corresponding log - entries from your panel.log ) for further investigations / solutions / work-arounds.

Additional informations:

Sometimes, it is as well a good idea to change the log - level ( TEMPORARILY! ), to get more informations in Plesk - log - files:

  • 10

Hi,

I will do that. Last time around that didn't solve the issue but I'll give it a spin!

second command gave me exit code 1.

Arguments: Array ( [0] => --reconfigure-all )

Details: Execution failed. Command: httpdmng Arguments: Array ( [0] => --reconfigure-server [1] => -no-restart )

Details: [2017-06-07 16:06:47] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:06:47] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:06:47] ERR [panel] Apache config (14968444060.42595600) generation failed: Template_Exception: AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

Unable to update the structure of the home directory: an unexpected error has occurred. Execution failed. Command: httpdmng Arguments: Array ( [0] => --reconfigure-all )

Details: Execution failed. Command: httpdmng Arguments: Array ( [0] => --reconfigure-server [1] => -no-restart )

Details: [2017-06-07 16:06:47] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:06:47] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:06:47] ERR [panel] Apache config (14968444060.42595600) generation failed: Template_Exception: AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

exit status 1

Third command gave me exit code 1

Checking Plesk version Installed Plesk version/build: 17.5.3 CentOS 7 1705170317.16

Checking for custom configuration templates ......................... [OK]

Checking for the JkWorkersFile directive in the Apache configuration [OK]

Checking associations between domains and IP addresses .............. [OK]

Checking for corrupted reference between IP collections and IP addresses ........................................................... [OK]

Checking for links between APS applications and subscriptions ....... [OK]

Checking for the Zend extension declaraion in php.ini ............... [OK]

Check symbolic links for latest virtual host config files ........... [OK]

Checking for system users home directories consistency .............. [OK]

Checking for records with empty name field in the Configurations table[OK]

Checking for nginx ULIMIT value ..................................... [OK]

Checking for extra configurations in database not owned by any object [OK]

Repairing web server configuration Reinstalling SSL/TLS certificates ............................... [OK] Applying the default SSL/TLS certificate to all IP addresses .... [OK] Repairing server-wide configuration parameters for web servers .. [2017-06-07 16:07:53] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/httpdmng' '--reconfigure-server'] with exit code [1] [FAILED] - httpdmng failed: [2017-06-07 16:07:53] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:07:53] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:07:53] ERR [panel] Apache config (14968444720.85357200) generation failed: Template_Exception: AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory Updating the file of sharing passwords and permissions of users according to actual information ................................. [OK] Repairing web server configuration for all domains. This aspect can be used with individual domains ("plesk repair web example.com"), and on the server level ("plesk repair web") ..... [2017-06-07 16:07:54] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/httpdmng' '--reconfigure-all'] with exit code [1] [FAILED] - httpdmng failed: Execution failed. Command: httpdmng Arguments: Array ( [0] => --reconfigure-server [1] => -no-restart )

Details: [2017-06-07 16:07:54] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:07:54] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/apache-config' '-t'] with exit code [1] [2017-06-07 16:07:54] ERR [panel] Apache config (14968444740.16805500) generation failed: Template_Exception: AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 AH00526: Syntax error on line 30 of /etc/httpd/conf/plesk.conf.d/webmails/geenkindaandekant.nl_webmail.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory

Checking the usage of PHP handlers

The following service plans have unregistered PHP handlers: ....... [ERROR] - Admin Simple - Default Domain - Unlimited - Default Simple The issue could be resolved only in the interactive mode (without -y and -n options).

The following domains have unregistered PHP handlers: ............. [ERROR] - vps-284144-5452.hosted.at.hostnet.nl - paperjamcollective.nl The issue could be resolved only in the interactive mode (without -y and -n options).

Error messages: 2; Warnings: 0; Errors resolved: 0

exit status 1

UFHH01

Guest
  • 11

Hi sjerp van wouden,

pls. make sure, that all needed Plesk packages are installed and use as well the command:

Pls. check issues/errors/problems in your Plesk - log - files and post the relevant log - entries for further investigations. Pls. don't forget, that the "DEBUG - log - level" helps a lot to get to a root causes during investigations!

If you investigate the logs, pls. make sure, that you solve issues like:

The following domains have unregistered PHP handlers: ............. [ERROR] - vps-284144-5452.hosted.at.hostnet.nl - paperjamcollective.nl The issue could be resolved only in the interactive mode (without -y and -n options).

... before your continue with the initial issues/errors/problems, to avoid further ( mostly relating ) issues/errors/problems!

Pls. don't just wait for additional suggestions, when issues/errors/problems as shown appear, because it states pretty clear, what you should do - pls. don't hesitate to follow the suggestions from your logs and report back WHAT you did and what the result was, so that people willing to help you are informed about your steps! ​

In addition, it could help as well to un- and re-install Plesk compoents, which often re-installs as well dependent packages. Consider to list the installed packages with for example:

Code:

plesk installer --select-product-id plesk --select-release-current --show-components --show-options

... while the following commands remove or install a defined component with the Plesk installer:​

Code:

plesk installer --select-product-id plesk --select-release-current --remove-component phpgroup
plesk installer --select-product-id plesk --select-release-current --install-component phpgroup

  • 12

Right before you posted that I ran the repair all command, I fixed the missing handlers, the "missing cgi_wrapper" issue persists. I set the debug level as your suggested and will run the second set of commands.

  • 13

    Hi sjerp van wouden, pls. make sure, that all needed Plesk packages are installed and use as well the command:

Thanks for your continuing answers. I appreciate it quite a lot.

I would love to do that but I'm not aware which plesk packages are needed. Some are obvious, some are not. Is there a list somewhere which packages are minimum required?

I'm looking at that list via the command you showed me. Quite wary of removing things...

Also: if I remove a component and reinstall it, will it's related settings be gone?

the upgrade components command got me from a 502 to a 404 error, btw. Thought I try that first.

I'm not sure which plesk error logs you refer to btw.

Last edited: Jun 7, 2017

  • 14

HOLD ON. I got it. I think. I will detail the steps above. But first, I'm going to calm my nerves. Thank you UFHH01.

UFHH01

Guest
  • 15

Hi sjerp van wouden,

removing and adding Plesk components can't "destroy" something, in fact, it mostly helps to get yourself back to some standarts, which are defined in components related configuration files - so you might consider to declare such solutions/work-arounds rather as a sort of "repair". But hey... it's up to you... I just try to help you with suggestions and investigations and you don't have to follow these suggestions.

I would suppose that uninstalling and reinstalling 'webservers' aka apache package would solve the issue?

I can't answer with "yes" here, because the statement "would solve the issue" can't be answered without a complete list of installed packages on your server, which might point to some missing ( depending ) components/packages.