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.

Edited by pentool
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.