Following the tutorials on this site when I try to connect to my mysql database with mysqli_connect(‘localhost’, ‘root’, ‘password’); I get the following error:
Fatal error: Call to undefined function mysqli_connect()
I am running windows Vista, PHP 5.3.3 and Apache 2.2.
My php.ini file is allowing the “php_mysqli.dll” extension and I’ve uncommented the 127.0.0.1 line in my windows hosts file as some people have suggested.
Finally I’ve tried swapping “localhost” with “127.0.0.1” in my PHP script and have still had no luck.
I’ve searched every forum I can find and have run out of things to try.
how have you installed PHP and Apache on your server?
if you installed them separately then you probably have a configuration issue somewhere.
another option you might want to consider is to delete your installation of PHP, Apache and MySQL (if you have it) and install a free open source local web server like XAMPP.
XAMPP comes bundled with PHP, Apache and MySQL preconfigured to work together and ready to go - just add water
hmm… I’m still confused - I understand you have to manually enable the mysql extensions in PHP5 - I’ve done this with php_mysqli.dll and php_mysql.dll and am still having no luck.
I added the PHP installation path in the Environment variables yes, I have also rebooted the system - I’ve followed the instructions exactly how they are on the page.
I uninstalled everything, php, apache, mysql - restarted my PC.
Set everything up again.
Still having the same problem - so now I’m officially stuck at this page in the tutorial because I can’t get any sort of success with mysqli_connect in php.
Actually… one question I wanted to ask - in the guide I’m following it states to rename a file called php.ini-dist in the PHP folder when setting up your php.ini file initially, however in my version of PHP this file didn’t exist, there were 2 other files instead:
php.ini-development
php.ini-production
They both look similar, I’ve tried modifying both with the instructions in the guide and have had no luck - this wouldn’t have something to do with my problem would it?