alkan — 2010-11-29T17:16:34-05:00 — #1
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.
system — 2010-11-29T17:49:57-05:00 — #2
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
scallioxtx — 2010-11-29T19:45:46-05:00 — #3
Take a look at the section "Installation on windows machines" here: http://nl3.php.net/manual/en/mysql.installation.php
Especially the bit about libmysql.dll
alkan — 2010-11-30T05:21:05-05:00 — #4
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.
scallioxtx — 2010-11-30T05:29:17-05:00 — #5
How about libmysql.dll? Did you do anything to let PHP find that? Please read the link in my previous post.
alkan — 2010-11-30T05:39:12-05:00 — #6
I've read the link, apologies I should have said in the previous post - I've added the link to libmysql.dll in the Windows PATH settings.
Still no luck.
scallioxtx — 2010-11-30T05:43:05-05:00 — #7
You know that you should put the path to the file in the windows PATH right, not just the file?
Also, for the PATH to take effect you need to reboot your system.
alkan — 2010-11-30T05:51:00-05:00 — #8
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.
alkan — 2010-11-30T07:35:20-05:00 — #9
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.
system — 2010-11-30T07:38:56-05:00 — #10
at this stage then I think your best option, so you can at least get going again, is to install a local web server like xampp as suggested earlier.
alkan — 2010-11-30T07:44:56-05:00 — #11
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:
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?