Red Hat Bugzilla – Bug 88656
Fatal error: Call to undefined function: mysql_connect() in /var/www/html/irm/include/DBI/class.DBD-mysql on line 40
Last modified: 2007-04-18 12:52:59 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
Description of problem:
Im running redhat 8.0 Linux 220.127.116.11 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):
Steps to Reproduce:
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
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
Is php compiled with mysql support? mysql extension is enabled in my
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
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:
Still, I suffer from the problem since I upgraded to RH9. PHP 4.2.2 is running.
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
"rpm -q php php-mysql" returns:
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:
Now, the entries relevant to MySQL in /etc/php.ini:
; 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.
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; Default host for mysql_connect() (doesn't apply in safe mode).
; Default user for mysql_connect() (doesn't apply in safe mode).
; 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.
Can you try *removing* the "extension=mysql.so" from /etc/php.ini?
I commented the "extension=mysql.so" entry from /etc/php.ini, restarted apache
and still, the problem persist.
Can you run:
$ echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html
then attach the produced php.trace and php.html.
Created attachment 91174 [details]
STDERR of echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt
Created attachment 91175 [details]
php.trace of echo '<?php phpinfo(); ?>' | strace -o php.trace php -Caq > php.html 2&>phpinfo-stderr.txt
Can you remove all the "extension=" lines from /etc/php.ini?
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/
Mmm... anybody can provide some help? Am I the only one having this problem or
does other could reproduce it?
Fatal error: Call to undefined function: mysql_connect()
is caused by the following two lines missing from /etc/php.ini
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
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
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
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:
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.
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
Bugzilla is not really an appropriate forum for getting support; I suggest you try
one of the end user support mailing lists:
shrike-list or psyche-list would be appropriate.