Bug 74542 - Fatal error: Call to undefined function: mysql_connect()
Fatal error: Call to undefined function: mysql_connect()
Product: Red Hat Linux
Classification: Retired
Component: php (Show other bugs)
i586 Linux
high Severity high
: ---
: ---
Assigned To: Joe Orton
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2002-09-26 08:52 EDT by -M
Modified: 2005-10-31 17:00 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-01-06 07:01:13 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description -M 2002-09-26 08:52:50 EDT
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):

How Reproducible:
Attempt connection to MySQL database using PHP

Actual Results:

Expected Results:
MySQL Connection

Additional Information:
Well this is what I found at

"You didn't read your manual with PHP, you MUST compile PHP with the following
switch: --with-mysql[=DIR]

This will allow you to use the PHP mysql API functions, ;-)

Please tell me that's wrong. =o(
Comment 1 -M 2002-09-26 09:24:53 EDT
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.
Comment 2 Joe Orton 2002-09-27 04:09:14 EDT

*** This bug has been marked as a duplicate of 72738 ***
Comment 3 Joe Orton 2002-09-27 04:12:06 EDT
Sorry, didn't meant to DUPLICATE this one.
Comment 4 -M 2002-10-01 03:44:58 EDT
Moving on to 8.0 release.
Comment 5 Need Real Name 2002-11-25 13:49:31 EST
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.

Comment 6 Joe Orton 2002-12-17 10:37:52 EST
Do you have the php-mysql package installed?

$ rpm -q php-mysql

Comment 7 Joe Orton 2002-12-17 10:40:42 EST
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
to "callihn".
Comment 8 David Lawrence 2002-12-17 11:17:02 EST
I have fixed the email addresses on this bug and others that were filed using
the 'callihn' account. Please use the 'callihn@hotmail.com' account from now on.
Comment 9 Tim Remple 2002-12-30 00:13:28 EST
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
NOT commented:

  the default was for it be be: ;extension=mysql.so   // i.e., commented out

I was then able to do a:
  mysql_connect("localhost", ...)
successfully; "localhost" is set to 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.
Comment 10 emanuel rasolofomasoandro 2002-12-31 09:10:25 EST
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. 
Comment 11 Joe Orton 2003-01-06 07:01:13 EST
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.
Comment 12 roel hagen 2003-01-06 11:50:12 EST
Can not find php-mysql 4.2.2 rpm package to solve problem with 8.0 install.
Any advice where to find this package?
Comment 13 Joe Orton 2003-01-06 11:55:39 EST
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"

Note You need to log in before you can comment on or make changes to this bug.