View Full Version : Connect to mysql using PHP

01-06-2006, 04:30 PM
I think I've got a configuration problem.

When I issue the command

$link = mysql_connect('localhost','root','<pswd>');
if (!$link){ die('<message>');

I never get to the 'if' statment.

The error I get is:

"Fatal error: Call to undefined function mysql_connect() in /usr/local/apache2/thdocs/test2.php"

Does this mean it does not recognize the function or the connect argument?

I completely new at this and loaded mysql via Red Hat rpm.

Any suggestions?

01-06-2006, 04:35 PM
Try this :

if(!($link_id = mysql_connect($hostadres, $username, $password))) die(mysql_error());

01-06-2006, 04:38 PM
PHP5 doesn't enable MySQL by default.

This page will be of use -

01-06-2006, 04:43 PM
what do you mean mark? Please explain me (i'm a total noob:confused: )

01-06-2006, 04:45 PM
The page I linked to explains the problem and solution.

Basically the MySQL extension library does not come with PHP (in Redhat only I think?), so you need to install it manually.