Im using IIS 6 and php5 andmysql5.0 and i can't figure out why i can't get the functions to work in php.

I'm getting the error:

Call to undefined function mysql_connect() in \server\mysite4\phpscript\connect.php on line 7

I have read a bunch of forums and I know that I have changed the necessary lines in the php.ini file. I just don't know what else I could have missed????

    Well, let's start out with the basics and work our way from there. First off, did you know that the mysql library has been deprecated in favor of the [man]MySQLi[/man] library (or even [man]PDO[/man])? My first suggestion would be to make sure you don't want to work on getting MySQLi up and running instead.

    If not, and you still want to use the old, deprecated mysql library, then the first thing you should check is if PHP is parsing the php.ini file you think it is. Try making a change, such as switching display_errors from Off to On (since it should never be "On" on a production server...) and then do a phpinfo() - did the value change, or did it stay the same? Don't forget that any time you make a change to the php.ini file, you'll need to restart IIS.

      So i have checked if it is parsing the right file. It is, the status changes after I restart my IIS.

      I have taken the ; off of each line for the php_mysql.dll files in the .ini file. I have added the php path to the PATH in windows.

      I don't know what else to do. I tried usig mysql_connect() and
      mysqli->real_connect() and both a basically returning me the same error. I assume it is because it isn't finding the right libraries but I have no idea how to fix this.....😕

        dutchboy83 wrote:

        I have taken the ; off of each line for the php_mysql.dll files in the .ini file

        I'm a bit confused by this - what do you mean "each line" ? There should be only one line that says extension=php_mysql.dll in the php.ini file.

        Also, let's check if a certain DLL is available to Windows; go to Start -> Run and type in libmysql.dll and hit enter. Do you get an "Open With" dialog that asks you how you want to open this file, or do you get an error message "Windows cannot find..." ?

          I mean that this is what that section of the .ini file looks like. I know that the mssql dll's aren't necessary but I uncommented them anyways.

          ;extension=php_mime_magic.dll
          ;extension=php_ming.dll
          extension=php_msql.dll
          extension=php_mssql.dll
          extension=php_mysql.dll
          extension=php_mysqli.dll
          ;extension=php_oci8.dll
          ;extension=php_openssl.dll

          I did the run for libmysl.dll and gives an Open with dialog so i'm assuming that the file is there....what should I do next...??:o

            Try commenting out the other extensions except for either mysql.dll or mysqli.dll .

            If that doesn't work, check in phpinfo() for the value of the extension_dir directive; what does it say? Is this the correct directory? Have you checked in this directory to verify that php_mysql.dll (or php_mysqli.dll) is actually there?

              I don't know if commenting out the other two lines helped, but I wasn't getting the right directory for extension_dir, now I am, it worked, thank you so much for your help!

                4 months later

                I'm having the same issue and I have done everything suggested thus far as well. phpinfo() is showing the correct PATH, the ini file is all configued correctly (I have checked 5 times over), all the DLL files are in the correct folders (everything from WINDOWS, to system32, to PHP\ext) and nothing seems to be working, I am still getting the Fatal Error Call to undefined function.

                Do you have any other suggestions?

                  Write a Reply...