I think I have a PHP configuration problem on my development machine where I am setting up a development environment which interrogates a local MySQL database from Eclipse on a Windows XP platform using an Apache server. I can execute the PHPINFO program so I have a minimal PHP system working. I can interrogate my database from within Eclipse with SQL explorer. When I run my first test program to connect and run a SQL I get the following error:

Fatal error: Call to undefined function mysql_connect() in C:\Eclipse Workplace\Rouse\WebContent\timetable.php on line 16

I don’t know how or where in the PHP configuration I would bring in the SQL routines. Does anyone know or am I on the wrong path.
Thanks!

With this kind of error it is common that a module in your php.ini file is commented. So in your php.ini file, uncomment the line that says:
;extension=php_mysql.dll
To uncomment the line simply remove the ; symbol at the beginning of the line. Also the php.ini file can be found with the phpinfo() function. Also be sure to make a copy of your php.ini file before making any changes.

Thanks cwarn23, I have already checked that.
When you do a phpinfo, should there be a major section for MySQL?
WBR

Thanks cwarn23, I have already checked that.
WBR

Just a note that before I forgot to type, a localhost server can have around 3 php.ini files while only one of them are active. So that is why I recommend using the phpinfo() function to find out which php.ini file is the real one. And could you also check the phpinfo() function to see if the mysql module (not mysqld) has been loaded and is on the phpinfo() list.

When you do a phpinfo, should there be a major section for MySQL?

Answer: Yes there should be and if that section does not appear then you probably have edit the wrong php.ini file or the changes were not done properly as the phpinfo() function gets most of its info from the php.ini file.

Note: Sorry for the double post but I couldn't find the edit button.

The php.ini file is in the Windows directory where I expected it to be.
In the PHP.ini file there is a extension_dir note:

; Directory in which the loadable extensions (modules) reside.
extension_dir ="C:\PHP\ext"

I found also that these extensions are listed in the PHP.ini file:

[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
extension=php_gd2.dll
extension=php_xsl.dll

The above files are in both the PHP/ext and the Windows/System32 directory.
This part of the configuration looks good to me.

When I run phpinfo.php file I have major sub divisions such as:

apache2handler
Apache Environment
Bcmath
calendar

I don’t see any reference to MySQL as a major sub division. All references to MySQL are in path variables.
Can you think of anything else I should look into?

WBR

One other clue, that does not help me, I see a section for ODBC, but not for MySQL.

There is only 1 PHP.ini file on my machine, yet in running phpinfo.php once again, I noticed I have a problem with the extension_dir directive. Under the heading “Configuration PHP Core” there is a listing for the extension directive:

Directive		Master Value	Local Value 
extension_dir	C:\php5                 C:\php5

I don’t have a PHP5 directory so I tried changing the default listing in the PHP.ini file from the default:

extension_dir = "./"

to

extension_dir = "C:\PHP\ext"

This should now match my machine. I am unclear of the proper syntax for the “extension_dir” directive in Windows?

extension_dir = “C:\PHP\ext”  or 
extension_dir = “C:/PHP/ext”

Still no changes in the phpinfo.php output so I then created a directory “C:\php5” and placed all the files there. This also has no affect on the output of my MySQL program?
Any insight into the extension_dir directive?
WBR

This question has already been answered. Start a new discussion instead.