[web] php conflicting with MySQL

This topic is 4214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I recently wrote a test application in PHP for connecting to a database. However, all I recieve is this error: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:/*directorypath removed*/type.php on line 2 Client does not support authentication protocol requested by server; consider upgrading MySQL client I am assuming this code is outdated compared to the MySQL and PHP servers running and thus will not connect. I am using: PHP 4.4.2 MySQL 4.1 [Edited by - lack o comments on July 4, 2006 5:40:49 PM]

Share on other sites
I'm not 100% sure, but i think that you need php_mysqli extension (of php) to use mysql 4.1 and above with PHP. Unfortunately, last time i checked - php_mysqli extension was only availiable for PHP5 and above.

Share on other sites
I tried installing php_mysql.dll before and ended up reomving it when I had errors like this:

PHP Warning: Unknown(): Unable to load dynamic library 'C:directorynamereomved\php_mysql.dll' - The specified module could not be found. in Unknown on line 0

I had set the 'extension_dir' value in "php.ini" to point to the extension directory with php_mysql.dll and I placed libmysql.dll in the "System32" folder. As far as I know, these files should support PHP 4.12 through 5.1.4

Share on other sites
are you sure you have set it in the correct php.ini file ?

Share on other sites
I set it in the php.ini found in the WINDOWS directory. Is there another one? There are none within the PHP folder itself.

Share on other sites
It sounds like a problem with MySQL's new password authentication (PASSWORD vs OLD_PASSWORD, etc.), probably caused with an older (php_mysql.dll) library 3.x or 4.0 trying to connect to a 4.1 or later server.

The mysql extension works, as long as it is built for 4.1. The mysqli extension would be more likely to work, since it has to be post 4.1.

One fix is to reset your password on the server to use the old format:
USE mysql;UPDATE user  SET password=OLD_PASSWORD('blah')  WHERE user='me'  AND host='%';FLUSH PRIVILEGES;

But I don't really recommend "fixing" the problem that way.

[Edited by - konForce on July 4, 2006 6:34:09 PM]

Share on other sites
You guys are correct. After some searching I've found that php_mysql.dll is for versions prior to 4.1. I need php_mysqli.dll The real issue now is that I can't find the page I downloaded it from (it also had php_mysqli.dll). I just saw it yesterday and now it's gone! If you happen to know where in that labyrinth of a website they are storing, please let me know ;)

 Meh, nevermind. I'm still having the problem from my last post, except now there are two dll's it can't find. I know it is using the php.ini file in the WINDOWS directory because I've tested other settings.

[Edited by - lack o comments on July 4, 2006 7:10:39 PM]

Share on other sites
You don't need to use mysqli to connect to mysql 4.1 or later. You just need a mysql client library which is compatible with the new passwords (i.e. the PHP mysql extension built against a non-archaeological MySQL client lib).

Alternatively, use the "old passwords" trick as above - this is fine for a non-production environment and will effectively sidestep the issue without recompiling anything.

Mark

Share on other sites
Ok, that's fine. But it is not issue I am having.

Thr problem is that PHP will not load the these extensions properly. I have been pouring over dozens of forums during the night and non at all can seem to tell me what is wrong.

I am absolutely certain that everything is in the correct place and being referenced. But just to recap:
libmsql.dll	-in System32 folder (also in "C:\Program Files\PHP")php_mysql.dll	-in the folder "C:\Program Files\PHP\ext"php.ini		-in "C:\Program Files\PHP"PATH variable	-contains "C:\Program Files\PHP" (so as to find php.ini)php.ini contains directory reference to "C:\Program Files\PHP\ext"	and reference to load "php_mysql.dll"

And all I get is the same error:

PHP Warning: Unknown(): Unable to load dynamic library 'C:\Program Files\PHP\ext\php_mysql.dll' - The specified module could not be found. in Unknown on line 0

This is driving me insane (that and the fact that I haven't slept since Friday...) Anything clue at all would be just dandy right about now.

Share on other sites
I assume when doing a phpinfo(), it shows that the correct php.ini is being loaded. And that it shows that extension_dir is at the right spot?

If that is all correct, then you are missing some helper DLLs. A common one is "php5ts.dll" (or the equivalent for 4). Putting them in the C:\Windows or C:\Windows\System32 (I don't remember which is recommended) should take care of the problem. I don't know which DLL's the mysql extension relies on, but probably something like mysqlclient.dll.

Share on other sites
Quote:
 I assume when doing a phpinfo(), it shows that the correct php.ini is being loaded. And that it shows that extension_dir is at the right spot?

Yes, I set the PATH environment variable to the location "C:\Program Files\PHP" which is where "php.ini" is stored. phpinfo() tells me the file is loaded correctly.

Quote:
 If that is all correct, then you are missing some helper DLLs. A common one is "php5ts.dll" (or the equivalent for 4). Putting them in the C:\Windows or C:\Windows\System32 (I don't remember which is recommended) should take care of the problem. I don't know which DLL's the mysql extension relies on, but probably something like mysqlclient.dll.

From what I have read, neither WINDOWS or System32 is recommended. It is recommended to place the files in the PHP directory and point the system PATH variable to that. Which I have done. I have also tried placing the files in WINDOWS and System32 in every combination imaginable.

As far as helper DLL's, I assume that is what "libmsql.dll" is for. Nothing ever really mentioned what it was, just that it was needed. Yes "php4ts.dll" was also present in the PHP directory, as well as Sytem32... and WINDOWS.

Just for the hell of it I tried installing PHP5 to see if it would play nicer with MySQL... it does not. Now, instead of seeing a dynamically generated page with errors printed on it I get... a browser dialog asking me if I want to download the entire site directory to my harddrive?! [totally]

[EDIT]
Ok, I've finally given up and taken the OLD_PASSWORD route. I just don't have the time to fool with this anymore. However, it still concerns me at how poorly PHP is working in regards to extensions. If anyone can put this issue to rest I would certainly love to know what is going on.

[Edited by - lack o comments on July 5, 2006 6:38:47 PM]

Share on other sites
I'm sorry that you're experiencing so many installation problems. PHP and MySQL are designed to work correctly, trust me. You should never need to put PHP_antyhing.dll in your system32 directory.

As you are having such a pain, perhaps it would be easier to pick up one of these already-configured win32 packages such as the ApacheFriends stuff or something?

In theory nothing should need any absolute paths to anything in its config file.

One thing you might want to try however, is installing it all in directories which don't contain spaces in their names - this may make it easier to configure it correctly.

Mark