PHP Fatal error: Call to undefined function mysql_connect()

 

Description

When executing a PHP script which is trying to access a MySQL database, the program fails fatally with the following message:

PHP Fatal error:  Call to undefined function mysql_connect()

Resolution

The MySQL libraries probably haven’t been installed for PHP. These aren’t installed by default. This is done on two distributions with the following commands:

Ubuntu:

   sudo apt-get install php5-mysql

Fedora:

  sudo yum install php5-mysql

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>