4

I have a problem regarding connecting the database it is giving this error

Fatal error: Call to undefined function mysqli_connect()

Which, I have spend the past 4 hours trying to figured out and I already did these steps:

  1. Change extension=mysql.so and extension=mysqli.so
  2. extension_dir=/PATH for php.ini
  3. Checked which modules are loaded or install with php - m

I JUST PUT MY INFOPHP() IN PASTEBIN SORRY, MY WEBSITE IS RUNNING UNDER USERNAME AND PASSWORD PROTECTING BECAUSE IS A PRIVATE UNIVERSITY SERVER..

http://pastebin.com/dKKdwWTb

I am not too sure what else I can do about, just in case I have added the link for paste bin for my php.ini file

http://pastebin.com/QNK6mGqV

Well, I hope someone could see what I have been able to see and could help me out.

5
  • What if you were to post your actual code that's producing the error *?* Commented Nov 1, 2013 at 2:10
  • Fred, this type of error does not really require code example. Commented Nov 1, 2013 at 2:13
  • @ItayMoav-Malimovka Ok, I thought I could help, seeing the subject line Call to undefined function mysqli_connect() Commented Nov 1, 2013 at 2:15
  • yah, its not error code.. its actually some problem with the apache server or mysql installation.. or something regarding not having the right path to get php.ini or some modules.. Commented Nov 1, 2013 at 2:17
  • fred - your comment is correct, unless the function is one that comes from an extension, and a famous one at that, (so no misspelling is possible here) Commented Nov 1, 2013 at 2:23

2 Answers 2

3

Check output of phpinfo() in web page. php -m is for cli, your mod_apache probably be using a different php.ini than the cli one.

edit

After seeing your web phpinfo() we can see my assumption is correct. You really are using a different php.ini for your apache, and in it the mysqli extension is not enabled.
in the phpinfo() output you have the details on where to find the php.ini file, and where is the extension directory.

Cheers.

Sign up to request clarification or add additional context in comments.

3 Comments

I just added the info in paste bin if you are looking for a specific part of the file let me know and I can upload it here.. sorry for the inconvenient but its a private server with user and pass protection to access the websites..
What do you mean with cli one? I changed the include_path and extension_dir to add the path that is showing right now.. I don't understand very well what I should do to fix it.. I will really appreciate your help.
You have two PHP binaries on your machine. One is connected to the Apache, and is the one u use when you surf to a web page. One u use when in command line (cli =command line interface) and is a completely separate PHP). The phpinfo() shows you which php.ini file is used by the web php binary. u need to edit this file and in it activate the mysqli extension
1

I was receiving the same error, and I had just installed MySQL Server 5.5, but I had forgotten to restart the Apache server. On Ubuntu systems you can issue the following command to restart:

sudo service apache2 restart

After I restarted, I was no longer receiving that particular error message!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.