Fatal error: Call to undefined function mysql_connect()
A 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.



