eagleworks — 2010-10-21T08:35:59-04:00 — #1
New here, and new to MySQL, but not PHP. Following the book and every single search result I can find on the issue, yet still not solved on my system.
I installed Apache/PHP/MySQL individually.
Apache is up and running.(2.2.17)
PHP is up and running.(5.2.14)
MySQL is up and running. (5.1.51 Community)
I can connect to MySQL via cmd.
However when I try to connect to my database using
$link = mysqli_connect('127.0.0.1', 'root', 'x4yu8');
$output = 'Unable to connect to the database server.';
$output = 'Database connection ok.';
I get the error which is ruining my day:
Fatal error: Call to undefined function mysqli_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 3
PHP is using the correct php.ini file.
PHP is listing the correct path for my MySQL install.
The correct ext path is in PHP.ini.
The link to php_mysqli.dll has had the semi colon removed.
The .dll exists on my system.
I have tried copying 2 .dll's to my system32 folder.
My windows7 HOSTS file is edited correctly for localhost/127.0.0.1.
As you can see, I'm nearly out of ideas.
I have a slight feeling it may have something to do with a lib mysql file?
Any help would be gratefully received.
dxm3119 — 2010-10-22T23:11:43-04:00 — #2
Now when I try to load the connect.php file I dont see anything, but all my other pages work still.
dsmit — 2010-10-21T08:41:53-04:00 — #3
Does phpinfo or 'php.exe -m' list the mysqli module as being loaded?
Because the error indicates it's not loaded properly.
lorenw — 2010-10-23T16:12:08-04:00 — #4
You should be seeing what is in output.html.php, make sure it is not an empty file ie... no echo statements. You can point your browser to output.html.php to make sure.
eagleworks — 2010-10-21T10:34:41-04:00 — #5
----------------- * SOLVED * -------------------
Guide to solving this issue;
If you are running PHP 5.2, as I was delete your main PHP directory.
Go to http://windows.php.net/download/
Read "If PHP is used with Apache 1 or Apache 2 then choose PHP 5.3 VC6"
Download "VC6 x86 Thread Safe (2010-Jul-21 20:06:17)" installer.
Install to the location that your previous PHP directory was located.
Select "Apache" for server type on install.
Point the install to your Apache sub folder "conf"
when installed, edit the end of "httpd.conf" and remove the lines the book "build your own database driven website using PHP&MYSQL" told you too add.
AddType application/x-httpd-php .php
Follow the books guides to modify the PHP.ini file with the correct location of your doc_root.
doc_root = C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs
PHP 5.3 has the mysqli extension already enabled and the windows temp folder.
Last thing to do is to double check the "extension_dir" setting, point it to the "ext" subfolder inside your PHP directory.
extension_dir = "C:\PHP\ext"
Should fix it.
Hope that helps someone.
eagleworks — 2010-10-21T09:13:13-04:00 — #6
mysqli is the improved version, however mysql or mysqli both don't work, when php.ini is set correctly anyway.
in phpinfo() the only MySQL entries are the paths which are correct;
C:\Program Files\MySQL\MySQL Server 5.1\bin;
Under modules I have no MySQL.
core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_php5
edit: Just to let you all know I've also got XAMP installed on this machine, and it all works fine using that setup. However I want to get this working. Problems need solving.
dsmit — 2010-10-21T08:46:49-04:00 — #7
No, it's not. mysqli is the MySQL Improved Extension. It's actually pretty common. See http://php.net/manual/en/mysqli.overview.php
harvp — 2010-12-02T20:15:44-05:00 — #8
I now have the same problem where nothing shows up when I got to localhost/connect.
IF I go to localhost/connect/output.html.php it shows that page fine.
It seems like the connection to sql is timing out as it takes awhile to load the page and then sits there with nothing on it. Like nothing is running.