0
votes

Running Apache with PHP and mysql5 on a mac (snow leopard)...

Apache is running

PHP is running ( works fine)

mysql is running (can connect)

however, the following code is throwing an error

$link = mysql_connect('127.0.0.1', 'user', '****'); 
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

Getting the following error:

Fatal error: Call to undefined function mysql_connect() in /opt/local/apache2/htdocs/ajax_login.php on line 4

1
Are you sure PHP has the MySQL library installed/enabled? Run phpinfo(). - Jason McCreary
where would i see that in the return of phpinfo() ? - timw07
It will have a section called mysql, and the table header will be : mysql support | enabled . Otherwise it means your php installation has no mysql support. Google a bit to learn how to set it up correctly... - ivy

1 Answers

1
votes

Make a phpinfo() page to see if you have working mysql support in php.

It will have a section called mysql, and the table header will be : mysql support | enabled . Otherwise it means your php installation has no mysql support. Google a bit to learn how to set it up correctly...

If you installed myqsl and apache/php / mysql-library independently, you could have made the mistake to mix different architectures; e.g. a 32-bit mysql client library in a 64-bit apache installation (or the other way around).