W.A.M.P. / localhost problem


I have WAMPserver 2.0 on my Windows 7 (64bit) system that I use as a localhost for my development environment.

It runs fine, except for when I want to load to a .php page that connects to a mySQL database.

I get this error:
[B]The connection was reset
The connection to the server was reset while the page was loading.

[/B]I’ve been googling for the last hour trying to figure out what is wrong, but to no avail.

I’ve checked my firewall settings and nothing appears to be blocked …

Anyone here have any ideas I might try?

Are you using “localhost” for the host name?

Yes, that is correct. A page that doesn’t connect to the database displays fine. For some reason it’s only those that need the database …

Is PHPMyAdmin able to connect to the database ok?

Yep, no problems there either. I can access the tables and data just fine. :confused2

So is it just a single script that is giving the problem?

Sounds like it has to be the values that script is using to connect to the database then.

If it is, then I am stumped to how …

I haven’t changed anything. In fact, I’ve been using the same connect script since forever. I believe I copied it out of the book I was using at the time:

define ('DB_USER', 'dxxxx');
define ('DB_PASSWORD', 'xxxx');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'data');

// Make the connection and select the database

$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ('<b>Could not connect to MySQL: <font color="red">' . mysql_error() .'</font></b>');

@mysql_select_db (DB_NAME) or die ('<b>Could not connect to the database: <font color="red">' . mysql_error() . '</font></b>');

When I change, say, my username the page loads and I get the standard:

Could not connect to MySQL: Access denied for user ‘xxxx’@‘localhost’ (using password: YES)

So, it must be correct … I just can’t for the life of me figure out why it won’t display the page …

Well, I finally managed to stumble upon the problem, so here it is for some closure:

It was the

[FONT=Arial][SIZE=3][FONT=Tahoma][SIZE=2]It seems that as of PHP 5.3, the link_identifier parameter is no longer optional. If not included, it would cause the script to crash with no errors in the output.

I removed it and the page would display. Sheesh.[/SIZE][/FONT]


ALSO, PHP5 likes to use mysqli() rather than mysql() - the new and improved version. Think about updating your scripts as that WILL be a problem with any hosted scripts (most hosts won’t provide both versions).