Jump to content

Fatal error: Call to undefined function mysqli_connect()


pentool

Recommended Posts

Hello,

 

I am opening a DB connection as such: 

$dbc = @mysqli_connect("localhost", M_USER, M_PASSWORD, M_DATABASE)
    OR die("Database connection failed");

 

It worked fine for months, and then today all of a sudden I didn't get any data from the DB any more. I had a brain fart and try to look everywhere. I knew it wasn't the code, since it worked so far.

 

So to make the long story short, turned out that when I removed the ampersat (@) I saw the error "Fatal error: Call to undefined function mysqli_connect()".

 

Something happened on the hosting account, and the mysqli extension just simply vanished or stopped working. This is new to me.

 

So I'm just curious, is there a way to detect if an extension "disappears" for some reason and display some message as opposed to staring clueless at a blank screen?

 

Thanks.

 

 

PS: The hosting company responded that they recompiled mysql and now it's working again - but I have no clue why did it disappear on the first place.

So I'm just curious, is there a way to detect if an extension "disappears" for some reason and display some message as opposed to staring clueless at a blank screen?

There are ways to check for the existence of a specific extension, yes, but everything in php is an extension so doing that everywhere would eb a nightmare.

The hosting company responded that they recompiled mysql and now it's working again - but I have no clue why did it disappear on the first place.

Because your hosting company are incompetent.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.