I’m working through Build Your Own Database-Driven Website Using PHP & MySQL, 4th Edition, by Kevin Yank, and have hit problems when connecting to mysql db using the first example php script. I’ve run through the windows installation guide and installed Apache and PHP. I’ve followed the instructions to create the php.ini file in C:\PHP. I’ve added the following to Apache’s httpd.conf:
LoadModule php5_module “C:/PHP/php5apache2_2.dll”
AddType application/x-httpd-php .php PHPIniDir “C:/PHP”
PHP scrips run fine but on trying the first mysql script example I get the following error.
Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
Running phpinfo shows the php.ini file isn’t loading, so the mysqli.dll extension isn’t active, giving the fatal error. C:\PHP isn’t shown as a valid path.
I’ve then copied php.ini to C:\WINDOWS, as this is in the path, and restarted apache. The same script runs successfully, but with the following warning:
[FONT=“Courier New”]Warning: mysqli_connect() [function.mysqli-connect]: Headers and client library minor version mismatch. Headers:50051 Library:50144 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
Database connection established. [/FONT]
So, in the immortal words of Marvin Gay, what’s going on? Have the installation instructions missed out on adding C:\PHP to the path, or should updating httpd.conf be enough to pick up the php.ini file?
Is the warning message indicating my installation has a problem?
The book said to come here with any problems, so here I am! Cheers.