Error connecting to MySQL with PHP4
| From: | Michael Franssen | Date: | Fri, 03 Aug 2001 12:39:09 +0000 |
| Subject: | Error connecting to MySQL with PHP4 | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-3818@lists.php.net to get a copy of this message | ||
Hi all,
I've just installed RedHat linux 7.0 (update) for intel and installed the Apache webserver, including a PHP4 module (libphp4.so) and MySQL. Apache works fine, including standard PHP (at least, the hello-world example works fine). Also, MySQL appears to be working fine, since I can use 'mysql mysql' to edit the members-table and add the 'nobody' account apparently needed by Apache.
However, when I try to run the following simple script to connect to MySQL on localhost, I get the baffling error: 'undefined function'. I thought that MySQL connections were standard baked in PHP4.
Does anybody know how to get this up and running without have to recompile and re-install apache and all other components from scratch? What's going on here anyway?
Thanks in advance!
Michael Franssen
-------------
<HTML>
<BODY>
<?php
echo "PHP is starting here<BR>";
$host = "localhost";
$user = "root";
$database = "ogodb";
echo "Trying to connect to $host as $user<BR>";
$db = mysql_connect($host,$user) or
die ("Connection could not be established<BR>");
echo "Connected<BR>";
echo "end of PHP.<BR>";
?>
</BODY>
</HTML>
The script above produced the output:
PHP is starting here
Trying to connect to localhost as root
Fatal error: Call to undefined function: mysql_connect() in /var/www/html/index.php4 on line 9