Bug 88656 - Fatal error: Call to undefined function: mysql_connect() in /var/www/html/irm/include/DBI/class.DBD-mysql on line 40
Summary: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/irm...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php
Version: 8.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-11 18:36 UTC by DeWayne Cox
Modified: 2007-04-18 16:52 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-06-13 06:32:55 UTC
Embargoed:


Attachments (Terms of Use)
STDERR of echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt (18.16 KB, text/plain)
2003-04-17 14:36 UTC, Hans Deragon
no flags Details
php.trace of echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt (62.78 KB, text/plain)
2003-04-17 14:36 UTC, Hans Deragon
no flags Details

Description DeWayne Cox 2003-04-11 18:36:12 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 
1.0.3705)

Description of problem:
Im running redhat 8.0 Linux 2.4.18.24 I have php-4.2.2-8.0.7 with PHP-mysql-
4.2.2-8.0.7 mysql-3.23.54a-4 with httpd -2.0.40-11

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:

2.
3.
    

Actual Results:  Fatal error: Call to undefined function: mysql_connect() 
in /var/www/html/irm/include/DBI/class.DBD-mysql on line 40


Expected Results:  IRM should have tied me into my database on my localmachine

Additional info:

Comment 1 Hans Deragon 2003-04-14 01:15:34 UTC
I have the same problem, but only since I upgraded from RH 8.0 to RH 9.0. 
Postnuke complains of the following:

Fatal error: Call to undefined function: mysql_connect() in
/perm/web/postnuke-phoenix-0.7.2.3/html/pnadodb/drivers/adodb-mysql.inc.php on
line 170

Is php compiled with mysql support?  mysql extension is enabled in my
/etc/php.ini file.

Comment 2 Joe Orton 2003-04-14 08:14:55 UTC
These both look like config bugs.  If you make a <?php phpinfo(); ?> page, does
it include a section for mysql support? If not, mysql isn't configured.

For 8.0, check that there is an "extension=mysql.so" line in /etc/php.ini.

For 9, check that the php-mysql package is installed, and you have a
/etc/php.d/mysql.ini file.

Comment 3 Hans Deragon 2003-04-14 11:41:37 UTC
I ran phpinfo and got:

Configure Command:             '--with-mysql=shared,/usr'
additional .ini files parsed:  /etc/php.d/mysql.ini,
supported databases:           MySQL

Content of mysql.ini:

  extension=mysql.so

Still, I suffer from the problem since I upgraded to RH9.  PHP 4.2.2 is running.

Comment 4 Joe Orton 2003-04-17 10:37:05 UTC
Hans, what does:

$ rpm -q php php-mysql

give? If you don't have a whole section on MySQL suppor then the extension isn't
getting loaded.





Comment 5 Hans Deragon 2003-04-17 12:36:34 UTC
"rpm -q php php-mysql" returns:

php-4.2.2-17
php-mysql-4.2.2-17

Please note that I am not an expert regarding php.  It might be a config
problem, but as I mentionned, it worked under RH8.0 and since I upgraded to
RH9.0, postnuke cannot call mysql_connect(). 

Following, the content of /etc/php.d/mysql.ini:

extension=mysql.so

Now, the entries relevant to MySQL in /etc/php.ini:

[...deleted lines...]
extension=mysql.so
[...deleted lines...]
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
' at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

Comment 6 Joe Orton 2003-04-17 12:40:28 UTC
Can you try *removing* the "extension=mysql.so" from /etc/php.ini? 

Comment 7 Hans Deragon 2003-04-17 12:50:18 UTC
I commented the "extension=mysql.so" entry from /etc/php.ini, restarted apache
and still, the problem persist.

Comment 8 Joe Orton 2003-04-17 13:20:57 UTC
Can you run:

$ echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html

then attach the produced php.trace and php.html.



Comment 9 Hans Deragon 2003-04-17 14:36:06 UTC
Created attachment 91174 [details]
STDERR of  echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt

Comment 10 Hans Deragon 2003-04-17 14:36:41 UTC
Created attachment 91175 [details]
php.trace of echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt

Comment 11 Joe Orton 2003-04-17 14:39:31 UTC
Can you remove all the "extension=" lines from /etc/php.ini?

Comment 12 Hans Deragon 2003-04-17 15:12:18 UTC
I just noticed that there exist a /etc/php.ini.rpmnew.  So I renamed my old
php.ini to php.ini.old and copied the php.ini.rpmnew to php.ini.  I then changed
only one parameter, magic_quotes_gpc to Off.  In this new php.ini, there are no
extensions defined, thus none to comment out.  I assume that I have now the
proper php.ini file for version 4.2.2 of php.

Unfortunatly, the problem still persist.  I noticed that include_path is
commented out.  I tried it as is and it failed.  Then, I have set it to:
include_path = ".:/php/includes", but it still fails.  Always the same problem.

BTW, you can see the error by visiting:  http://site.deragon.biz/postnuke/

Comment 13 Hans Deragon 2003-06-01 23:18:58 UTC
Mmm... anybody can provide some help?  Am I the only one having this problem or
does other could reproduce it?

Comment 14 Douglas Clinton 2003-06-02 02:15:44 UTC
The error:
Fatal error: Call to undefined function: mysql_connect()

is caused by the following two lines missing from /etc/php.ini

extension=mysql.so
extension_dir = /usr/lib/php4/

Simple add these lines and restart mysql AND httpd and calls to mysql_connect()
and its bretheren will work fine

Douglas Clinton


Comment 15 Hans Deragon 2003-06-07 17:41:24 UTC
Thanks Douglas for your comment, but if you have read the exchange between Joe
and I, you would have noticed that I already tried your solution and the problem
still persists.

Comment 16 Joe Orton 2003-06-07 21:26:18 UTC
Ah, sorry Hans.  I have just noticed this error in your stderr trace above:

PHP Warning:  Unable to load dynamic library '/usr/lib/php4/mysql.so' -
/usr/lib/libmysqlclient.so.10: symbol errno, version GLIBC_2.0 not defined in
file libc.so.6 with link time reference in Unknown on line 0

which is the reason why your mysql extension is not working - PHP *is* trying to
load the extension, but it fails.

I think the cause of this bug is that the libmysqclient library provided in
RHL8.0 is not compatible with the glibc used in RHL9.  So after you upgraded, it
no longer works.

The fix should be to upgrade to the mysql packages provided in RHL9.  Can you
try that?

Comment 17 Hans Deragon 2003-06-08 00:47:31 UTC
Thats it!  Me neither I have not noticed this error.  My apologies.  I installed
mysql-server from the disk and look what I had at one point installed:

MySQL-3.23.54a-1
MySQL-client-3.23.54a-1
MySQL-devel-3.23.54a-1
MySQL-shared-3.23.54a-1
mysql-server-3.23.54a-11

As you see, there was a mix of the official mysql server from RH and other RPMs
provided by AB.  I then tried to upgrade with the RPMs of MySQL 4.0 from AB but
there was a conflict with the php-mysql and perl-DBD-MySQL rpms, so I then
remove all the packages that caused problems and installed those that came with
the distribution.  Not surprising, everything went fine after that.

Sorry for the time wasted on this issue. My bad and thanks for lending your eyes.

Comment 18 Jonas Rullo 2003-06-13 05:28:09 UTC
I'm having the same problem. I installed RH8 from CD, then used the update
agent. I have yet to see any mysql functions work in PHP scripts. I installed
all the latest mysql bits from the redhat site and all the version numbers
match. What tests can I perform to be sure the php/mysql pieces I have installed
are correct? 

Comment 19 Joe Orton 2003-06-13 06:32:55 UTC
Bugzilla is not really an appropriate forum for getting support; I suggest you try 
one of the end user support mailing lists:

https://www.redhat.com/mailman/listinfo/

shrike-list or psyche-list would be appropriate.


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