Hi everybody,

I'm just getting started.

I've installed php5 manually on my PC having win XP sp2 and I am using IIS 5.1
I've also installed mysql 5.0

I've been able to create database and table in mysql

But when I connect using my php script, i got the following error:

fatal error: call to undefined function mysql_connect().

I've done the following things:
1) I check out the /ext folder and I found both php_mysql.dll and php_mysqli.dll
2) I check out the php.ini where i uncomment the part extension=php_mysql.dll and as well extension=php_mysqli.dll
3) I save the file

But I got the same error again

Can anyone suggest a solution or had I miss something

Regards,

Dave

    Create a file that contains:

    echo phpinfo();

    and see if your php is working ...

      Yeps, I've done that and it displays all information concerning the configuration of PHP.

      What should I see in particular?

        Look for "MySQL Support" something like this should appear:

        Active Persistent Links  0  
        Active Links 0
        Client API version 4.1.12
        MYSQL_MODULE_TYPE external
        MYSQL_SOCKET /var/lib/mysql/mysql.sock
        MYSQL_INCLUDE -I/usr/include/mysql
        MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

          mysql_*() functions do not exist anymore in PHP5.

          You have to use mysqli_*() functions :
          http://ca.php.net/manual/en/ref.mysqli.php

          ALSO, make sure to configure PHP5 to load mysqli !

          If you are on Windows, make sure to copy libmysql.dll in C:\WINDOWS\ or C:\WINNT\ and/or in C:\WINDOWS\System32\ or C:\WINNT\System32\

            You have to use mysqli...

            No, you don't have to (you should, but that's not the same thing).

            Have you followed the instructions here, such as putting libmysql.dll in Windows' PATH, setting extension_dir, and restarting the server?

              suntra wrote:

              mysql_*() functions do not exist anymore in PHP5.

              Why does it say

              mysql_real_escape_string

              (PHP 4 >= 4.3.0, PHP 5)

              on the function description page then?

                Oops, I think I didn't put the libmysql.dll in the c:\windows\system32\

                In the PHP.ini file, where do I write the extension_dir=C:\php\ext\

                I shall check the different links as well

                Thnks in advanced

                Regards,

                Dave

                  Note that copying files to the system32 is highly deprecated -- it even says so in the PHP.net manual:

                  Previous editions of the manual suggest moving various ini and DLL files into your SYSTEM (i.e. C:\WINDOWS) folder and while this simplifies the installation procedure it makes upgrading difficult. We advise you remove all of these files ... the preferred method for installing PHP is to keep all PHP related files in one directory and have this directory available to your systems PATH.

                  To learn more, read: [man]install.windows.manual[/man]. For information about adding PHP to the system PATH environment variable, see this page (FAQ #14).

                    Ok, In fact I've already put this line C:\php in the path for environment variables. But I still don't know where to write the extension_dir=C:\php\ext\

                    Regards,

                    Dave

                      Where is your php.ini file located? Search this file for "extension_dir" and you should find that setting.

                      If you've added c:\PHP\ to the PATH variable, have you moved all of the dll files (especially libmysql.dll) from the 'dlls' folder into the main c:\php\ folder?

                        Well, I finally got the solution.

                        I find out that I did not rename the php file to php.ini and put that file in C:\Windows

                        I also put the extension_dir path in the php.ini

                        Definitely, now my application can connect to MySQL

                        Thanks for everything everyone

                        Regards,

                        Dave

                          Write a Reply...