[RESOLVED] MYSQL Won't work at all
Hey guys, as the title says, MYSQL isn't working.
Using home computer (XP) to build a website, and its my first time using MYSQL. I have apache (2.2.3) and PHP (5.2.0) working fine, and decided to include a database for this site I'm doing. So i downloaded MYSQL (5.0.27), and installed it, expecting it to work as easily as apache and PHP have done in the past, but no, it wants to be different.
I try to connect, but doesn't seem to get past there:
Code:
<?php
echo "hello"; //This is displayed.
$con = mysql_connect("localhost","username","password");
echo "hi"; //It doesn't reach here, meaning something is wrong with above line.
//more code
?>
Yes i have completely switched off the firewall, made sure the username/password is correct, etc etc.
I also read somewhere that...
Code:
<?php
phpinfo();
?>
...would display information relating to MYSQL if installed, but it only brings up PHP info.
I have now installed it at least 8 times over the past few days, each time making sure the previous installed files/registry settings are gone, rebooting afterwards, and even using guides to make sure I'm doing it properly. No luck so far. Anyone have any ideas?
There are probably better places to ask this, but what the hell :p
Re: MYSQL Won't work at all
try looking at the error messages generated by apache in error.log, or just use:
Code:
$con = mysql_connect("localhost","username","password") or die(mysql_error());
a call to phpinfo() will just tell you if the libraries are installed, and they are included by default (in 4 at least, haven't dabbled in 5 so I'm not sure if it comes with it or not -- but I assume so).
Re: MYSQL Won't work at all
It will tell you if the PHP extension is installed, to be precise - and I'm not sure if this is the default case in 5.2.x.
What you really should change are your error reporting settings in PHP. If it dies with a fatal error, it should emit an error message. Check the error_reporting value in your php.ini.
Re: MYSQL Won't work at all
Look for a MySql section in the phpinfo() output. If its not there you need to enable the extension.
You also need to ensure that you have installed mysql and the root installation directory is in the PATH environment variable or the libmysql.dll is in the Windows directory.
Re: MYSQL Won't work at all
Thanks for your help guys - mistake realised!
Cheers. :thumb: