Re: PHP/MySQL not playing nicely. Server drops connection. . .

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Williams wrote:
Hi All,

I recently installed PHP, APACHE, MYSQL per the method at the following site:

http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/

. . .I then attempted to connect to a database (but without executing any commands on it), and I keep receiving the following error:

Safari can’t open the page “http://localhost/~michwill/folder/ validate_event.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later.

I'm really not sure what the problem is or what to do about it. Can anyone help? I've ensured that all passwords and ports are correct. I've also tried using MAMP, but it keeps telling me that I can't access the database with the "connect" commands I'm using (although I've adjusted them. Anyway, any help would be much appreciated.


Are you sure that Apache is running and accepting connections to /~michwill? Does a regular HTML page show up ok?

Have you checked the server error log?

What does your script look like where it connects? Does it simply die() without a message? Try creating a test script with header('Content-type: text/plain') at the top. Then print out messages after each step. (beginning of script, opening a DB connection, etc.)

How are you accessing the database? Whichever method, test for errors after each step and echo out any info there. eg. with MDB2:

$mdb2 =& MDB2::connect($dsn, $options);

if (PEAR::isError($mdb2))
{
  die ('Failed to connect: ' . $mdb2->getMessage());
}

If the MDB2 object is kosher but you have an SQL error:

$result = $stmnt->execute($data);
		
if (PEAR::isError($result))
{
  die('bad query: ' . $result->getUserInfo());
}

Of course, you shouldn't blindly echo out this sort of thing on a production server.

brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux