Fatal error message

Like so many others, I am getting the following message:

Fatal error: Call to undefined function mysqli_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

I verified that the mysqli.dll extension was not commented out (i.e., I removed the semicolon [;] in front of it in the php.ini).

Next, I ran the PHP info script and got the following:

The following PHP extensions are loaded on this server
Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => date
[5] => filter
[6] => ftp
[7] => hash
[8] => iconv
[9] => json
[10] => odbc
[11] => pcre
[12] => Reflection
[13] => session
[14] => libxml
[15] => standard
[16] => tokenizer
[17] => zlib
[18] => SimpleXML
[19] => dom
[20] => SPL
[21] => wddx
[22] => xml
[23] => xmlreader
[24] => xmlwriter
[25] => apache2handler
)

I can see that mysqli.dll is not loading. Even though I have restarted my computer often since first installing PHP, Apache and MySQL, I restarted Apache by going to the system tray and choose “Restart” from the Apache web server icon. I ran the PHP info script again and got the same output as above (shrug).

Are there any new ideas on how to solve this problem? Thanks in advance for any help.

Have you checked if you have the php_mysqli.dll file in the php/extensions dir. The dir is located in your php installation.

What software package are you using? WAMP? MAMP? XAMPP? SomeOtherAMP*?

TeNDoLLA, yes "mysqli.dll " is in the PHP.ini file. I removed the “;” in front of it so that it is not commented out.

In the PHP.ini file, I also have the extension directory pointed to “c:/php/ext” where this file type resides.

StarLion, I downloaded MySQL, PHP, and Apache separately. This was recommended by Kevin Yank’s book on building database driven websites. Except for this hiccup, everything has worked fine.

I am running Windows 7 (Home Premium) if it matters. I also installed the following version of each program:

PHP 5.2.17 (VC6 Thread Safe)
Apache 2.2.19 (Win 32)
MySQL (shouldn’t matter for this) 5.5.12 (Win 32)

I have also tried other things:

1.) Adding C:\PHP to the PHPRC to the system enivornment path
2.) Adding C:\PHP to the Path in system environment path
3.) I have used “php_mysql” with the “i” at the end and changed the index.php file that tries to connect to the sql database, accordingly

I have been researching this problems for about 10 hours total and I am still coming up short. Any help is much appreciated. I am still about 5 hours away from my breaking point where I download the all-in-one package :slight_smile: I would prefer to have everything running separately.

I am posting this for future frustrated readers of Kevin Yank’s book (Build Your Own Database Driven Website) who have reached the part about connecting to MySQL.

When/if you receive the “Fatal Error” message, you probably need to do the following:

1.) Go to the Control Panel and find the “System” or “System environment” variables (Might be under “System Properties:Advanced:Environment Variables”
2.) Under the “System Variables” heading you will see 2 columns (“variable” and “value”)
3.) Look for the one labeled “Path” and double-click it (or choose “Edit” with it selected)
4.) A long string of file paths that are all separated by a “;” will appear.
5.) Add “;C:\PHP” to the end <– you do not need the quotes (")
6.) Click OK, click OK, and click OK again
7.) reboot
8.) run “http://localhost/connect” and I hope this works for you as well as it did for me (you should see “database connection established” if it works)

If the above steps don’t work then try to follow them to step 3 and instead of adding “C:\PHP” to the path variable, create a new one called, “PHPRC” (<-you don’t need the quotes) and make the path “C:\PHP” or wherever you have your PHP.ini file.

I took the first step and the latter step at the same time before rebooting, but I am pretty sure the first one is what fixed it.

Good luck!

Now I am looking forward to continuing on in the book.

Hey, kudos to you for biting the bullet and doing it the hard way - its the only way to learn.

It is painful I agree, but ultimately worth it - armed as you now are with a much better understanding of how this (W)LAMP stuff is wired up.

Given your attitude and determination I am sure its going to go well for you from now on, welcome to SP by the way.

BTW, there is no question about PHP too daft to ask here, or that has not been asked before.

Northrut, I got exactly the same problem as yours (>_<), searched the forum and found your posting. Yep, that fixed my problem! \^o^/ Thanks, God!!! I think it is quite surprising that nobody else has thanked you yet.