Jump to content

Fatal error: Call to undefined function mysqli_connect()


Glese

Recommended Posts

After I did enable the following error reporting:

 

   Default Value: E_ALL & ~E_NOTICE

 

I am getting the error message described in the title of this thread.

 

I do have the php_mysqli.dll extension enabled as well - AND the function used to work as is, before I changed the error reporting, thus the function actually should be defined, what could be another reason, that PHP thinks it is not a defined function?

Link to comment
Share on other sites

When restarting the Apache server I also get the error message:

 

synatx error, unexpected '&' in .../php.ini on line 110.

 

And line 110 is:

 

Default Value: E_ALL & ~E_NOTICE

 

EDIT:

 

I am quite sure it has to do with the php.ini, I must be doing something wrong, because if I revert the error_reporting back to the default with the ; in the front, then the mysqli_connect function does work again.

 

I only enabled the above error reporting to get rid of the notices.

Link to comment
Share on other sites

While developing, you want all notices to be displayed so you can fix their causes.

 

It looks like you managed to uncomment a line that is there to show you how to set it up. That line should have the semicolon at the beginning of it, to indicate it is a comment. The actual value (for developing) should simply be:

 

error_reporting = -1

Link to comment
Share on other sites

I did try your suggestion as follows, I hope I did it right:

 

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED
error_reporting = -1

 

And now the mysqli function does work, but also, I am still getting notices, and it seems as if I did not adjust error_reporting at all, which means as if it is like it was in the beginning.

Link to comment
Share on other sites

This one for example:

 

Notice: Constant DB_HOST already defined in C:\...\connectvars.php on line 2

 

Just for you notice, I do understand your suggestion of proper coding, though this is an older project and I am not so serious about solving the notices.

 

Just out of curiosity what would be the sign for having the serious errors excluding notices? This one did not work for me:

 

error_reportign = E_ALL ^ E_NOTICE

 

And this one did not work for me as well:

 

error_reporting = E_ALL & ~E_NOTICE

Link to comment
Share on other sites

error_reporting = E_ALL & ~E_NOTICE should be right. Restart Apache after making any changes, of course. You can verify its value with phpinfo();

 

That notice would be very easy to fix with !defined(), or maybe by changing a call to include to include_once, BTW.

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.