[SOLVED] Apache 1.3 and php 4.4.2 installed - add mysql 4

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

[SOLVED] Apache 1.3 and php 4.4.2 installed - add mysql 4

Post by batfastad »

Hi guys

I've been using Apache 1.3.33 on our local intranet and today I upgraded php to 4.4.2 from
http://www.php.net/downloads.php
I used the zip file version and just overwrote all the existing files I had in my c:\php directory and removed and copied all the extensions.

This is on windows 2000 and I just use it as a windows test machine on our local network as I develop more and more intranet services.

I need to now add mysql support and I've installed it and successfully connected to localhost as root using the windows mysql administrator, so mysql's all working.


But what do I need to do to get php and apache to recognise the new existance of mysql, if anything?
My aim is to get phpmyadmin installed to manage the databases.


I've tried a test script...

Code: Select all

$user="root";
$password="rootpassword";
mysql_connect(localhost,$user,$password) or die ("Can’t connect to MySQL.");
echo "Connected to MySQL.";
mysql_close();

and I get the following error...

Code: Select all

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in...
And I've copied the files php5ts.dll, libmysql.dll to my c:\php directory (which is in the path variable), and php_mysqli.dll to c:\php\extensions as per...
viewtopic.php?p=250571#250571

But I'm still getting that error.

Is there anything else I need to do to tell php and apache that mysql exists?
I've searched on google loads and found loads of tutorials all designed for getting a full apache, php and mysql installation working from nothing, but there doesn't seem to be any information on adding mysql to an existing apache / php installation.


Also, should I upgrade to Apache 2 and PHP5??

I currently use OpenSSL 0.9.8 to create a self-signed certificate for remote use of our intranet with http auth password protection.
Would all that still be possible with apache 2 and php 5?

I'm guessing though I could equally just upgrade apache to v2 and leave php at 4.4.2.
Would upgrading to PHP5 break all of my php4 scripts? From what I've seen of php 5 code so far - it looks almost identical but with certain functions having new options / parameters.

Thanks

Ben
Last edited by batfastad on Fri Jul 14, 2006 9:18 am, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I can't really help you with your main problem - not sure how to fix it because it's on Windows.

However, no, you don't need to update Apache. Apache doesn't care if MySQL is installed or not - just the PHP engine.
No, you shouldn't update to PHP5 either (though that could be argued) for the simple fact that MySQL isn't enabled by default in PHP5.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

This is a result of the upgraded authentication algorithm MySQL uses in version higher than 4.1. In your my.conf file, look for the section that looks like this...

Code: Select all

[mysqld]
In it, add the next two lines in the first part of the section

Code: Select all

[mysqld]
#Use old password encryption method (needed for 4.0 and older clients).
old_passwords
There is information about this in the MySQL manual. I have also posted about this issue in these forums before.

viewtopic.php?t=51144
viewtopic.php?t=42814
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post by batfastad »

Hi

Yep I initially thought that the password hashing would be the problem.
But yesterday before I posted the message I tried ticking that option in the MySQL Administrator program, and it didn't make any difference.
MySQL Administrator added that command to the end of the my.ini file.

I've made that change today to the start of the

Code: Select all

[mysqld]
section and I'm still getting that error message.

I've restarted MySQL (and Apache for what it's worth).
When I go in to MySQL Administrator as root, that option is ticked but I'm still getting that error.

The mysql section is showing up in phpinfo, i'm running php 4.4.2

Any ideas?


Thanks

Ben
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

The easiest thing to do is look into your user table. If the passwords are 16 chars long, they are old passwords. If they are 41 chars long, they are new passwords. If you are trying to authenticate with old-passwords, the hash makes the password 16 chars long (which won't validate against a 41 char hash).

Have a look at the data and let us know what you find.
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post by batfastad »

Right that's sorted it!!

Obviously when I created the root user using the installer it created a 41 char password and stored that in the table.
Then I created a test user, and I still had the new-style passwords enabled in the my.ini file.

Now having added the old_passwords option (either manually or using MySQL Administrator), and creating a new user.

That new user now has an old password stored.

So the problem is that the passwords were stored in the new format because they were created before I added the old_passwords option.
Users created since the option was turned on, have the old style passwords stored.

EDIT: Changing the password for a "new password" user, causes their new password to be stored with the 'old_passwords' option applied as well. So just update the passwords of the users that aren't working!



Thanks for the exact pointer to the problem - the users table!

Hopefully this will help someone else having a similar problem!!


Thanks

Ben
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Something else you can use also, the OLD_PASSWORD() MySQL function. If you need to update passwords that are in the new format, you can run the password through OLD_PASSWORD() to make it a 16 char hash instead of the new 41 char hash.
Post Reply