Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I get this error in my scripts:

Fatal error: Call to undefined function mysql_connect() in /var/www/login/includes/db.php on line 10

I have uncommented

I dont know why its not working, restarted everything aswell.

I am running on ubuntu 32 bit. Apache/MYSQL is installed with full permissions.

Here is my PHPInfo page:

System  Linux 2.6.18-194.3.1.el5.028stab069.6 #1 SMP Wed May 26 19:05:45 MSD 2010 i686
Build Date  Jan 6 2010 21:40:40
Server API  Apache 2.0 Handler
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php5/apache2
Loaded Configuration File   /etc/php5/apache2/php.ini
Scan this dir for additional .ini files     /etc/php5/apache2/conf.d
additional .ini files parsed    /etc/php5/apache2/conf.d/pdo.ini
PHP API     20041225
PHP Extension   20060613
Zend Extension  220060519
Debug Build     no
Thread Safety   disabled
Zend Memory Manager     enabled
IPv6 Support    enabled
Registered PHP Streams  zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps
Registered Stream Socket Transports     tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters   string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.* 
share|improve this question
Where's db.php? specifically line 10 – DKNUCKLES Sep 23 '10 at 22:27

Do you have the apt package php5-mysql installed on the system? You can install it with sudo apt-get install php-mysql.

share|improve this answer
+1, if mysql_connect() is undefined, he does't have the extension loaded. Chances are there was a line to uncomment in php.ini, but the .so didn't actually exist on disk. – tim Sep 24 '10 at 3:44

Ubuntu keeps the PHP-specific mysql stuff in /etc/php5/conf.d/mysql.ini. If they were there, they'd be auto-loaded by PHP and show up in the phpinfo/php -i output, an d you'd see something like:

additional .ini files parsed    /etc/php5/apache2/cli/pdo.ini,

Since they're not showing up in your output, they're not present, so you've not installed the php5-mysql package, which contains the mysql.ini and files:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.