Bug 74542 - Fatal error: Call to undefined function: mysql_connect()
Summary: Fatal error: Call to undefined function: mysql_connect()
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php
Version: 8.0
Hardware: i586
OS: Linux
high
high
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-09-26 12:52 UTC by -M
Modified: 2005-10-31 22:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-01-06 12:01:13 UTC
Embargoed:


Attachments (Terms of Use)

Description -M 2002-09-26 12:52:50 UTC
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):
up2date


How Reproducible:
Attempt connection to MySQL database using PHP

Actual Results:
Error


Expected Results:
MySQL Connection


Additional Information:
Well this is what I found at
http://www.mysqldeveloper.com/faqs/faqMaster/index.cgi?do=display&id=13

"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 13:24:53 UTC
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 08:09:14 UTC

*** This bug has been marked as a duplicate of 72738 ***

Comment 3 Joe Orton 2002-09-27 08:12:06 UTC
Sorry, didn't meant to DUPLICATE this one.

Comment 4 -M 2002-10-01 07:44:58 UTC
Moving on to 8.0 release.

Comment 5 Need Real Name 2002-11-25 18:49:31 UTC
I am having the same problem, but here are a few more (hopefully helpful) 
details.  

- 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 15:37:52 UTC
Do you have the php-mysql package installed?

$ rpm -q php-mysql



Comment 7 Joe Orton 2002-12-17 15:40:42 UTC
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 16:17:02 UTC
I have fixed the email addresses on this bug and others that were filed using
the 'callihn' account. Please use the 'callihn' account from now on.

Comment 9 Tim Remple 2002-12-30 05:13:28 UTC
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)
required

2.) ensure that the following line in /etc/php.ini (line #498 or thereabouts) is
NOT commented:
  extension=mysql.so

  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 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.

Comment 10 emanuel rasolofomasoandro 2002-12-31 14:10:25 UTC
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
database.

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 12:01:13 UTC
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 16:50:12 UTC
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 16:55:39 UTC
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
Network.
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.