Login
New User

Welcome to destr0yr's asylum
Monday, October 06 2008 @ 07:55 AM PDT

Fatal error: Call to undefined function mysql_connect()

LinuxA customer I support on Plesk 7.5.4 on RedHat 7.3 was receiving the following error after they upgraded PHP to 4.3.10 from something very old: Fatal error: Call to undefined function mysql_connect().

I believe more happened between the time they received the error and the upgrade, ie. they tried to downgrade first. Oh well...

From http://www.somacon.com/p109.php

Cause
The mysql.so extension library does not come with the PHP or MySQL distributions. It must be installed separately by downloading the php-mysql RPM.

In this customers case, php-mysql was installed. However, the php.ini did not have an entry for mysql.so, nor did the phpinfo have a 'mysql' section. A couple ways to make quick'n easy phpinfos:

# cat << EOF > phpinfo.php
> <? phpinfo(); ?>
> EOF


or...


# echo "<? phpinfo(); ?>" > phpinfo.php

# updatedb && locate mysql.so
/usr/lib/php4/mysql.so

In php.ini:
extension_dir="./"
Changed to:
extension_dir="/usr/lib/php4"
Also added (with the other extensions):
extension=mysql.so

Ran php -v and /etc/init.d/httpd configtest which did not return any errors. Restarted Apache with /etc/init.d/httpd restart. Disaster averted.

Story Options

Trackback

Trackback URL for this entry: http://www.destr0yr.com/trackback.php/undefined_function_mysql_connect

No trackback comments for this entry.
Fatal error: Call to undefined function mysql_connect() | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.