DelphiFAQ Home Search:

Fatal error: Call to undefined function: mysql_connect()


comments50 comments. Current rating: 4 stars (18 votes). Leave comments and/ or rate it.


I install Apache, php 4.1.2 and mysql on RedHat Linux. When calling a php script that connects to the mysql database, I get this error message:

Fatal error: Call to undefined function: mysql_connect()
in /var/www/html/buyersguides/global/ on line 12


Most likely mysql is not enabled on your php installation. You configured this when you compiled the php sources.

Create a dummy HTML page on your web server with the php code from below and call it through the web browser. It will tell you if mysql is enabled. (If you do not see a table with parameters for mysql, then mysql is not enabled in your php build.)

How do I enable mysql in my php installation?

If you have an RPM based system like Mandrake, then you need to install package php-mysql-4.3.2-3mdk.i586.rpm. You may need to resolve the requirement of libmysql12 - these are shared libraries needed to dynamically load and use MySQL.

Visit libmysql on and get the RPM there.

Install it all then with and restart Apache:

[root]#ls *.rpm

   -rw-r--r--  1 nobody nogroup  22333 Jul 26  2004 php-mysql-4.3.2-3mdk.i586.rpm
   -rwxr--r--  1 nobody nogroup 263560 Aug  9 10:55 libmysql12-4.0.23-2mdk.i586.rpm

[root]#rpm --install libmysql12-4.0.23-2mdk.i586.rpm

   warning: libmysql12-4.0.23-2mdk.i586.rpm: V3 DSA signature: NOKEY, key ID 70771ff3

[root]#rpm --install php-mysql-4.3.2-3mdk.i586.rpm

   warning: php-mysql-4.3.2-3mdk.i586.rpm: V3 DSA signature: NOKEY, key ID 70771ff3

[root]#apachectl -k restart

On a system that is not based on RPM installation you need to go to your php installer directory and call configure to create a new make file, then recompile:

# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
# make
# make install
At the end do not forget to restart Apache.

  echo phpinfo();


You are on page 4 of 4, other pages: 1 2 3 [4]
2020-07-03, 12:01:38
Marissa from Lebanon  
purchasing antibiotics in mexico
2020-07-04, 21:34:25
keflex price walgreens
2020-07-05, 18:51:30
where can i buy real viagra online
2020-07-10, 17:26:57
aquarium cleaner chloroquine
2020-08-04, 03:36:09
can you buy hydroxychloroquine over the counter
You are on page 4 of 4, other pages: 1 2 3 [4]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: