All,

I've recently installed Apache version 2.2, MySql version 5.1, and PHP version 5.2.13 and am using Windows as my OS. I've gotten PHP to work on the Apache server, and MySql is working properly on its own. However, when I try to connect to a mysql database, I get this error:

fatal error: "undefined function mysql_connect()"

I've read literally 20 to 30 tech forums about this error. It appears to be a common problem with php versions 5 + because mysql extensions are no longer bundled with php. However, I've tried every fix imaginable and still nothing. Fixes I've tried include:

1. removing the semicolon from the php_mysql extension in the php.ini file
2. adding both c:\php and c:\php\ext\ to my PATH directory (php is my main directory)
3. ensuring that my libmysql.dll is located in the same folder as my php.exe file
4. ensuring that the php_mysql extension is available in my c:\php\ext folder

Despite all of these steps (and many more), I've still had no success. Can someone please help me, I'm about to give up on PHP because of this problem...

Recommended Answers

All 4 Replies

Member Avatar for rajarajan2017

Better you uninstall all the thing and Just installed all in one package XAMPP while installing almost all the things are configured automatically. Just connect the database.

http://www.apachefriends.org/en/xampp.html

Its a free open source and easily configured. After installed check with the browser

http://localhost

This is my suggestion.

Plz restart your WAMP server(PHP+Mysql+Apache)
if ur using windows
and If u r using Linux.. restart LAMP server....

This is caused by PHP not loading the MySQL modules. To fix: make sure the file php_mysql.dll (php_mysql.so on non-windows) is in the ext folder of the PHP install; Make sure that the php.ini file that is loaded tells PHP to include that module and that all settings for it are given. Hope this helps.

Better you uninstall all the thing and Just installed all in one package XAMPP while installing almost all the things are configured automatically. Just connect the database.

http://www.apachefriends.org/en/xampp.html

Its a free open source and easily configured. After installed check with the browser

http://localhost

This is my suggestion.

Thanks for the advice Raja. I installed WAMP 2.1 and everything is working very smoothly. Appreciate the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.