• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

Can't connect to mysql through php4

I am a newb, I'm sure you guys have never heard that one before.

Web Server specs

iis 6
mysql 5
php 4

Ok, I am trying to get VSP stats to work...a php script that generates stats for multiple pc games. I had php5 and mysql5 functioning ok, at least well enough to be able to install phpbb. I tried installing VSP but when I would browse to index.php to view the skin I would get a blank page. So after reading through their knowledge base, I found that a lot of people (not everyone) had trouble installing vsp using php5 so I downgraded. It now tries to load the vsp skin but I get "could not connect to database". I also get the same error when I try to re-install phpbb. The way I understand it is that mysql support is builtin to php4. You aren't supposed to have to do anything but I realize it's not always as simple as that. PHP is working, the link between php and mysql seems to be broken.

Please help this newb,
Josh
0
sittnduck
Asked:
sittnduck
  • 6
  • 3
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>the way I understand it is that mysql support is builtin to php4.
you have to check if the php_mysql.dll is really enabled (ie not decommented) in the (relevant) php.ini file.
to check, run a php file on the server with phpinfo() function, and cofirm with the output.

>but I get "could not connect to database".
* is the mysql up and running (this might sound silly question, but I have seen too many people saying "outsch..." after that question)
* does the php code use the correct connection settings? can you connect locally with mysql command line tool? can you validate the connection permissions?
 
0
 
sittnduckAuthor Commented:
First off, thank you for responding!

In the relevant php.ini, there is no line for "php_mysql.dll" under extensions. Should I add that line and upload the dll? "Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it." is why I assumed it was builtin and ready for action.

MYSQL is running and I in no way consider that a silly question at this point. I am a newb! It is running however, I can work from a command line in it.

Does this help?

http://67.14.214.83/test.php
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you are correct, in php 4.4.x the mysql in built-in, so no issue there.
note that you should remove the test.php ASAP again.

can you connect to mysql with external programs (mysql command line for example).
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
sittnduckAuthor Commented:
test.php has been deleted, it made me nervous to make that available but I thought maybe it would be of use.

I can work from a command line and I can also connect via navicat which you may already be familiar with. If not it is a third part sql management tool. Is that what you are looking for is it not a true test to see if mysql is working with external programs?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
then, please post the php code you use to connect, do you use mysql_error() to show any connection errors?
0
 
sittnduckAuthor Commented:
Do you want the install.php script's code for phpbb? I haven't customized it. It worked before with php5 and mysql5, I never had to add or modify a line in it to get it to connect to mysql and create the db. Now, with mysql4 and php4 I get "could not connect to database" when trying to install. I can send you the code but it seems like it is maybe something in the php4 config not allowing me to connect(because the phpbb install script's code has not changed, what has changed is I have now reverted back to php4 to try and vsp stats to work). Let me know if you still want me to post that code. Can you give me the necessary php code to test the connection to mysql? To see if it gives me any more details as to what the problem is?
0
 
sittnduckAuthor Commented:
Access denied for user 'ODBC'@'localhost' (using password: NO)
0
 
sittnduckAuthor Commented:
<?php
include("config.php");
mysql_connect("$localhost", "$myusername", "$mypassword");
mysql_select_db("$mydb");
echo mysql_error();
phpinfo();
?>

That's the code I used that gave me the error above.
0
 
Julian MatzJoint ChairpersonCommented:
<< Access denied for user 'ODBC'@'localhost' (using password: NO)
It means that your $mypassword variable is most likely an empty string...
Try entering your login details directly...
0
 
sittnduckAuthor Commented:
I figured it out, I had to run the following command for each of the user accounts I had created because
of the different password authentications. It resolved the problem.

SET PASSWORD FOR 'zoooz'@'some_host' = OLD_PASSWORD('mypass');


Thank you both for responding.

I will award both points because I am appreciative of your input. AngelIII, you helped me narrow it down by using a php connect mysql test script. The  error it gave me pointed me in the right direction.

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now