Windows Mysql 5.5 and php5.2: mysql_connect() breaks the script, no output

788 Views Asked by At

Whenever a mysql function is called, the script just dies. No output, and no "die" output either. No output about it on the php error logs either. I can't log into the db and access at all. Php just dies and I get a screen as if there was no page. How can I fix this? Or at the very least, get any output about the error to troubleshoot?

Same happens when using root. And, even when the info is wrong, there's no output. But, when going to the Drupal site, there's output at least when the log in info is wrong.

Here's the code of my main site's db class

class DB{
    public $con = null;
    public $user = 'viewer';
    public $pass = 'viewer';

    function __construct(){
        ini_set('display_errors', 1); 
        error_reporting(E_ALL);
        echo $this->user.' '.$this->pass.' wee';
        $con = mysql_connect("localhost",$this->user,$this->pass);// or die(mysql_error());
        //echo "connected";
        //mysql_select_db("db_name", $con);*/
    }

    function query($query){
        /*$query = mysql_real_escape_string($query);
        $return = mysql_query($query) or die(mysql_error());
        return $return;*/
    }
    function fetch_array($result){
        //return mysql_fetch_array($result);
    }

    function __destruct() {
        if (isset($con) ){
            mysql_close($con);
        }
    }
}
?>

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

Alright! Found what it is: On MetalFrog's recomendation, I started enabling mysqli (and learned about it and plan to look into it more), when I ran apache, it gave this error output:

The procedure entry point mysql_slave_query could not be located dynamic link library libmysql.dll

That was the error. When using just the mysql extension, it didn't check for that, and as such, the error was quite subtle. In my case, the extra libmysql.dll was on apache/bin. It would be more often that it's on windows/system32. Only the /php one should be in the path.