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



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
.



Relevant Pages

  • Re: Same Internal Server Error from last two days
    ... I am trying to run a Hello World Perl Script in Apache 2.2. ... But its constantly giving me Internal Server Error.The script ... # have to place corresponding `LoadModule' lines at this location so the ...
    (perl.beginners)
  • Same Internal Server Error from last two days
    ... I am trying to run a Hello World Perl Script in Apache 2.2. ... But its constantly giving me Internal Server Error.The script ... # have to place corresponding `LoadModule' lines at this location so the ...
    (perl.beginners)
  • object references/memory access
    ... between two python programs on the same machine. ... it remains in the memory of a server program. ... the search script is called by Apache. ...
    (comp.lang.python)
  • Re: aceptable loading time/CPU load
    ... > the local server with no one else working on it). ... If your script is computing the human genome, ... Apache Benchmark tool. ...
    (comp.lang.php)
  • Re: Installation sequence
    ... right server in your script. ... below require one of the portupgrade ports to be installed, ... then don't use the portsdb or pkgdb commands, ...
    (freebsd-questions)