1

I am currently using local MAMP setup on a Windows PC to connect to a MySQL database. But running the following code throws an error.

CODE:

$connection = mysqli_connect($host, $user, $pass, $dbname);

ERROR:

Warning: mysqli_connect(): Headers and client library minor version mismatch. Headers:50541 Library:50634 in C:\MAMP\htdocs\mysql.php on line 14

Checking my phpinfo, the versions are infact different. I am not sure if this error matters or not and how to fix it. I am using PHP 7.1.1 and MySQL 5.6 with phpmyadmin.

SECTION FROM PHPINFOenter image description here

Any help would be greatly appreciated. Been quite frustrating. Thank you and Cheers!

eArshdeep
  • 29
  • 5
  • are you really using mysql or the fork mariaDB? this might be relevant => http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch#22454051 – Louis Loudog Trottier May 21 '17 at 00:26
  • Possible duplicate of [Headers and client library minor version mismatch](http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch) – Louis Loudog Trottier May 21 '17 at 00:27
  • @LouisLoudogTrottier All answers I have found so far are either for older versions of php that recomend you upgrade to mysqlnd, which is default in PHP 5.5+. Also they recommend you achieve this through linux commands, which I can't run on my pc – eArshdeep May 21 '17 at 00:35
  • @LouisLoudogTrottier No, I am using MySQL – eArshdeep May 21 '17 at 00:36
  • @LouisLoudogTrottier is their anyway to match "Client API library version" to "Client API header version"? – eArshdeep May 21 '17 at 00:37
  • I've upgraded my system yesterday and it resolved most issues by reinstalling phpmyadmin after mysql and php update but i'm working on Linux. That would've ben my recommandation to update your pacakge from command line. If this happend after an update, did you restart all of the MAMP services? – Louis Loudog Trottier May 21 '17 at 00:48
  • Yes, MAMP was restarted. I have also actually heard that this error isn't always a big concern. Would you say this is so? – eArshdeep May 21 '17 at 00:54
  • it does say 'Warning' (and not Error) so i wouldn't worry too much about it on dev. but you want to get rid of this before you go live, at least so you don't stack your error log for nothing.If everything else works as expected of course. – Louis Loudog Trottier May 21 '17 at 02:18

1 Answers1

0

I noticed that you are using MAMP. Had the same problem, and full uninstall followed by fresh install of MAMP/MAMP PRO solved the problem.

I suspect it's because of unclean upgrades from previous version.

my mysqli version info after fresh install

  • Hey, thanks for pointing this out. It turns out the reason for the header mismatch was due to the different versions of software bundled in MAMP. This was fixed when MAMP pushed out a new update. I no longer have the same problem with version 4.2 of MAMP for Mac. – eArshdeep Oct 10 '17 at 00:17