Red Hat Bugzilla – Bug 74542
Fatal error: Call to undefined function: mysql_connect()
Last modified: 2005-10-31 17:00:50 EST
Description of Problem:
Fatal error: Call to undefined function: mysql_connect() while using PHP to
connect to MySQL. Since they are defined an the only thing that has changed here
is what version of redhat I am running it on I feel a need to report this.
Version-Release number of selected component (if applicable):
Attempt connection to MySQL database using PHP
Well this is what I found at
"You didn't read your manual with PHP, you MUST compile PHP with the following
This will allow you to use the PHP mysql API functions, ;-)
Please tell me that's wrong. =o(
By the way I am not getting any email in reagrds to submitted bugs and have also
had problems getting them to come up in a search by emaill address sometimes I
get none and sometimes I get all but I always select all the status options.
*** This bug has been marked as a duplicate of 72738 ***
Sorry, didn't meant to DUPLICATE this one.
Moving on to 8.0 release.
I am having the same problem, but here are a few more (hopefully helpful)
- Server 1: redhat 8.0 (apache, php, mysql) with all published updates
- Server 2: a remote apache webserver
- Running phpinfo() on Server 1 indicates that php was built with mysql ( --
with-mysql=shared,/usr ) but does not show any mysql extension settings
(appears that php cannot find mysql??).
- On Server 1, I cannot execute mysql_connect(---,---,---).
- On Server 2, I can run php with mysql_connect() to Server 1 just fine.
Do you have the php-mysql package installed?
$ rpm -q php-mysql
callihn, the reason you aren't receiving bugzilla messages (for instance, this
one) is because your e-mail address is not correct in bugzilla, it is just set
I have fixed the email addresses on this bug and others that were filed using
the 'callihn' account. Please use the 'firstname.lastname@example.org' account from now on.
I got this to work w/ the php-mysql-4.2.2-8.0.5 package in a single system
(i.e., localhost) configuration. Trick was:
1.) install the php-mysql package
otherwise /usr/lib/php4/mysql.so file was not present, and it is (apparently)
2.) ensure that the following line in /etc/php.ini (line #498 or thereabouts) is
the default was for it be be: ;extension=mysql.so // i.e., commented out
I was then able to do a:
successfully; "localhost" is set to 127.0.0.1 in /etc/hosts in the usual way
Note that you do need to stop and retart the httpd service after making any
changes to php.ini, since the PHP module in Apache appears to read that .ini
file one time at start-up.
Just finished going through the exact same path as Tim Remple.
It is not a bug, I simply had not loaded the php-mysql package
on RH 8.0, package which allows php applications to access MySQL
1.Once you get the package, simply do a
$rpm -i /path/to/the/php-mysql.rpm
2.enable the extension=mysql.so line in the /etc/php.ini file
(which is commented out by default)
3.Restart the httpd service with a
$service httpd reload
Should be good to go now.
Marking this NOTABUG; installation of php-mysql should mean that the
extension=mysql.so line is uncommented in /etc/php.ini but that was never 100%
reliable. That problem is fixed properly in the Phoebe beta.
Can not find php-mysql 4.2.2 rpm package to solve problem with 8.0 install.
Any advice where to find this package?
As given above:
1. find and "rpm -i" the package "php-mysql-4.2.2-8.05.i386.rpm" from the third
CD, or just run "up2date php-mysql" if the system is registered with the Red Hat
2. check that the line "extension=mysql.so" is uncommented in /etc/php.ini
3. restart the web server "service httpd restart"