Fatal error at call mysql_connet();

A

Anonymous

Guest
Hello,

I have a small problem.
I am using Linux Debian woody 3.0 and I have installed Apache and php on several of my machines. On 2 another one I have installed MySQL (Master - Slave).

I can connect localy to my DB and run query no probs.
In an .inc file where i have
mysql_connect("host", "user", "pass");
But when i try to use the web site and log into the Db i have

Fata error: Call to undefined function mysql_connect(); in connection.inc

But I repeat in with local host my test were running OK

here my code
Code:
<?php

    $username = "root";
    $password = "";
    $primary = "192.168.1.8";
    $backup = "192.168.1.6";
    $timeout = 15;  // timeout in seconds

    if($fp = fsockopen($primary, 3306, &$errno, &$errstr, $timeout)){
        fclose($fp);
        return $Link = mysql_connect($primary, $username, $password);
    }
   if($fp = fsockopen($secondary, 3306, &$errno, &$errstr, $timeout)){
        fclose($fp);
          return $Link = mysql_connect($secondary, $username, $password);
    }

    return 0;


?>

I have checked in the httpd.conf and the .inc files are treated by php

i ve tried as well to use
extension=mysql.so in the php.ini file but didnt work and anyway doesnt make any sence cuz MySQL not installed on this host

I have forgotten to add that I have a user with all the privilege who can connect (i though)from all the host (%)

but when I do a telnet 192.168.1.8 3306 from my apache web server, I login and then after 5 secs :

Connection closed by foreign host...

I dont knw if those two probs are related...

So I am a bit lost
Thanks

Francois
 
cho@ said:
Fata error: Call to undefined function mysql_connect(); in connection.inc

...

i ve tried as well to use
extension=mysql.so in the php.ini file but didnt work and anyway doesnt make any sence cuz MySQL not installed on this host

Well, your problem is, indeed, that your installation of PHP doesn't have the MySQL extension loaded. Depending on how you have PHP installed, you may have to recompile PHP with MySQL installed. Refer to the documentation for more information.
 
I ve found my mistake....

apt-get install php4-mysql

MySQL module wasnt installed for php....
:oops:

francois
 
Back
Top