Results 1 to 4 of 4
Jan 26, 2012, 03:41 #1
- Join Date
- Jan 2012
- 0 Post(s)
- 0 Thread(s)
Problems loading the mysqli extension in my local installation of PHP (with Apache)
I'm having some problems loading the mysqli extension in my local installation of PHP and am getting the "Fatal error: Call to undefined function mysqli_connect()" error. I've read around a bit on the internet and have tried numerous things. First things first my current set-up is:
Windows 7 Home Premium SP1 64 bit
IIS is not disabled - but this is mainly because when I went looking for it I could not find it so suspect Win 7 home premium does not come with it. In spite of this point I'm connecting to Apache through port 8080 as I could not get it working through the default port (80?)
Apache 2.2.21 (Win 32)
PHP 5.2.17 (vc6 thread safe version)
My SQL seems to be running fine as I've been in and run stuff using the command line interface. Also my IDE (JetBrains PhpStorm) has a database connector to allow for control and maintenance of the DB within the IDE. This also connects up just fine and I've run some SQL scripts through the IDE.
Right then so stuff I've tried (in approximate temporal order) I restated the Apache server after each of these and have also totally re-booted the system at least once:
I followed all the instructions in Kevin Yank's book: Build Your Own Database Driven Website using PHP & MySQL (4th Edition)
Check the php.ini file in "C:\PHP"
I have the right path to the extensions folder "C:\PHP\ext"
the semi-colon in front of "extension=php_mysqli.dll" is removed
the semi-colon in front of the similarly titled "extension=php_mysql.dll" above is not removed
Run <? php phpinfo() ?>
There is no section for mysqli module.
There are 8 references to MySQL but in each case they are due to the inclusion of "C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin" in the PATH environment variable.
Under PHP Core I can see that doc_root = "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs" and that extension_dir = "C:\PHP\ext". These are both the values I set in my PHP.ini file so I'm pretty sure the right one is being used. Also the loaded configuration file at the top confirms the same.
I added C:\PHP to the PATH environment variable. I can see this in phpinfo() so I know this has worked.
I heard it might be a versioning issue with libmysql.dll so I copied the version of this file from the MySQL installation (in "C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib") over the version in "C:\PHP". This replaced a 1 meg file with a 4 meg file, which seems like quite a movement.
I've also tried moving this file up into "C:\PHP\ext", "C:\Windows", "C:\Windows\System32" to no avail. The file is deleted from these locations now.
I've seen some old posts suggesting you need to get the connector software from MySQL rather than the bundled software with the PHP installation, however these all point to the following page http://dev.mysql.com/downloads/connector/php/,which is now dead. If I go to http://www.mysql.com/downloads/ then I don't see a download option for PHP connector.
I saw another post http://www.sitepoint.com/forums/show...57#post4721657 that claimed to have fixed this issue by installing PHP 5.3. However when I go to http://windows.php.net/download/ the guidance there was to only use the vc6 versions with apache. Currently the vc6 versions are under PHP 5.2 (the PHP 5.3 versions are both vc9). As you can see above I used the thread safe version, I wasn't totally sure on the difference but on reading around I gathered it shouldn't make too much difference.
Any other thoughts on what to do (or undo) would be gratefully accepted. I really need to get this set up as it's holding up some development I need to do. I previously had the whole thing up and running on my old laptop but it died and so I'm having to get everything up and running on a new computer.