msgbartop
Illustrates and Examines some of the best tools and ideas in Computer Science
msgbarbottom

10 Mar 09 (in php) Fatal error: Call to undefined function mysql_connect()

I occassionally play around with php, mysql and apache web server in Windows as
well as linux. Today when I was fiddling with php-mysql in Windows, I came across the error given in the title of this post as well as below. The solution was pretty simple,though, there was a small amount of struggle to search in google and to edit the config files appropriately.

Fatal error: Call to undefined function mysql_connect()

[phpdir] — the folder where php is installed in Windows

1)Open [phpdir]\php.ini using your favourite editor and
change the line
;extension=php_mysql.dll
to
extension=php_mysql.dll

2) Ensure that the file php_mysql.dll is present in [phpdir]\ext

3) Ensure that the dll file libmysql.dll is present in [phpdir]\

4) Restart the Apache server if that still does not work then restart the computer.

Note :
[phpdir] — the folder where php is installed in Windows

Test whether the php module has properly included mysql
by opening a file containing the line <? phpinfo(); ?> on your web server.