Link to home
Start Free TrialLog in
Avatar of big3425
big3425

asked on

Need help with getting PHP5 to connect to MySQL.

Help me  -  Help me

I can't seem to get PHP to connect to MySQL through even a simple script.  I have a box running xp and a box running win2k and both will not connect.  My xp box gets the "undefined function" and nothing happens at all with my win2k box.

Here is what I have done so far:
1. Installed both PHP, MySQL, and a web server
2. I installed PHP with the windows installer, then I also downloaded the zip file for php and unzipped it into the PHP folder.
3. I am using Macromedia Dreamweaver as my development program.
4. I have successfully executed the standard Hello World.php with my web server so I know PHP is working.
5. I deleted the php.ini file on my win2k box in the winnt folder and added to my windows PATH the c:\PHP folder.
6. I went into my php.ini file in my PHP folder and took out the ";" in front of the extension for mysql.

I have a simple database query that connects or dies, then creates a database.  I don't get any errors when I execute this file, but when I go into mysql, the database has been created.  Help Please.
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of big3425
big3425

ASKER

Ok, I rebooted the machine and did your script.  I do have a MySQL section.  But, now I am getting the error connecting to mysql.  this is definately the farthest I have gone.  so what now??

Thanks.

Ray
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of big3425

ASKER

Ok, it has the correct path.  Should I uninstall everything or just install the all in one? thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"somehow right"?  Why, am I known to be wrong all the time?
RQualding is rgiht, all you need is to have mysql/bin and php directory in your path. If you copy any dll in your system32, windir or whatever, you will get unpredictable results when you will upgrade php or mysql.
Avatar of big3425

ASKER

Thanks to all of you.  I have definately been struggling with this setup, but now I have finally gotten it to connect.  Now I can go and learn and build my website.  Thanks.

Here is what got me to the solution.

First of all, I wasn't rebooting after making changes.
But, after installing, these are the actual modifications I made:

1. I had to use Abyss Web Server, because I couldn't get Apache configured correctly.
2. Then I had to unzip the full PHP package into my PHP folder.
3. Then I had to add the PHP and MySQL folders to the windows PATH
4. Then I changed the php.ini file - uncommented the mysql extension and put localhost in and also the default port of 3306.
5. Then I rebooted - it worked after that.  Thanks guys.
I am sorry mattjp88. I didn't mean to be rude. I cannot find the right words sometimes :)
You're the man.
big3425  - Follow the install.txt file from the php directory. It is not quite necessary to reboot the computer. If any error messages paste them on google. You will finally manage to get apache/php/mysql talking to eachother

mircea.
If you want it working right now, here is a package that installs apache/php/mysql all together, preconfigured to work together.

http://www.wampserver.com/en/

-Matt
Sorry, forgot you got it working.  But if you want apache, that link should work for you.