0

Basically,

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 extension:mysql.so

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 rabbits.org 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.* 
  • Where's db.php? specifically line 10 – DKNUCKLES Sep 23 '10 at 22:27
1

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

  • +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
0

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,
/etc/php5/apache2/cli/mysql.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 mysql.so files:

/usr/lib/php5/20090626/mysql.so
/etc/php5/conf.d/mysql.ini

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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