0

So I've uncommented the the *extension=php_mysql.dll* line in the php.ini file and I've also filled in the *extension_dir* and *doc_root* but everytime I try to run a php file with the following code:

<?php
  mysql_connect("localhost", "root", "admin") or die(mysql_error());
  echo "Connected to MySQL<br />";
?>

I get the following error:

"Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\vhosts\guestbook\extract.php on line 3"

Does anyone know how to fix this?

hakre
  • 193,403
  • 52
  • 435
  • 836
theNoobProgrammer
  • 924
  • 2
  • 15
  • 34

2 Answers2

0

Your PHP is enabled - that's what's throwing the error you are seeing.

The problem is with the PHP config. The mysql extension is not loaded.

I've uncommented the the *extension=php_mysql.dll* line

And have you checked the file exists in the specified extension dir and is readable by the webserver?

Have you checked that this is the php.ini file your webserver is using? (try running a script with just a call to phpinfo() in it).

symcbean
  • 47,736
  • 6
  • 59
  • 94
  • there were multiple php.ini files and that i think is what caused the problem. as soon as i removed the php.ini file that was already in the windows directory it worked. Thanks for all your help – theNoobProgrammer Sep 20 '11 at 17:24
0

It sounds like you have either not restarted Apache for php.ini changes to take effect, or that you do not have the PHP /ext path in your system PATH variable (or it's set wrong in php.ini).

Consider using a pre-configured and fully set up WAMP package such as:

xampp (free) - WampDeveloper Pro (commercial) - WampServer (free)

rightstuff
  • 6,412
  • 31
  • 20