Jump to content

Cant access MySQL from PHP script


Recommended Posts

Im having trouble with connecting to mysql server from my php script. When I tried to setup phpMyAdmin it returns an error like this:
"Cannot load mysql extension. Please check your PHP configuration. - Documentation"

When I tried to connect to mysql database using my own script ($connection = mysql_connect('localhost', 'user', 'pass') it returns an error message like this:
"Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\db.php on line 9"

I copy the libmysql.dll to WINDOWS/system32 directory and php.ini to WINDOWS directory, I also set the extension_dir of php.ini to "c:\php\ext" where is the actual location of extensions in my php installation directory and i Uncomment the extension=php_mysql.dll

I used the following versions:
PHP 5.1.4-Win32
MySQL-essential-5.0.24-Win32
Apache 2.0.59-Win32

I also tried MySQL-essential-4.1.21-Win32 but still it returns an error.

What should I do?
Link to comment
Share on other sites

When you made the changes to the php.ini and moved the files did you restart Apache? You restart Apache in order for the changes to come into effect.

Also it has nothing to do with the MySQL server. It is a PHP configuration issue. Please [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]read this FAQ[/url]. It should help you.
Link to comment
Share on other sites

Did you read the FAQ I link you to?

Also is PHP using the correct php.ini? You can check this by creating a test script (test.php) and then adding the following code to it:
[code]<?php phpinfo(); ?>[/code]
Look for the following line - [b]Configuration File (php.ini) Path[/b]. To the right of that it should have the full path to the php.ini it is using. Is the the path C:\WINDOWS\php.ini?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.