PEAR::DB connection timeout
| From: | Matthew Weier O'Phinney | Date: | Mon, 15 Nov 2004 02:34:33 +0000 |
| Subject: | PEAR::DB connection timeout | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15496@lists.php.net to get a copy of this message | ||
Note: I'm not sure if this is a PEAR::DB issue or a more general PHP
mysql_* issue; I haven't tried rewriting the routines I'm working on
without the PEAR::DB abstraction. If anyone feels I need to post this to
a different list, I'm more than open to that.
I'm working on rewriting some code into a more general API that we can
use (the previous code interspersed HTML and PHP, and we're now moving
to a fully templated system). Our development environment includes
Apache 2.0.50, PHP 5.0.2, and MySQL 4.0.18. We are using DB 1.59.
The code I'm testing does the following:
1) Inserts a record into a table using DB's autoExecute()
2) Grabs that record's new ID (using the MySQL LAST_INSERT_ID()
function)
3) If a certain array is set, prepare()s an INSERT statement, then loops
over the array, execute()ing the statement for each element.
4) If another array is set, does the same as 3 for that array and table.
(3 and 4 are to set elements in link tables for the newly created
record.)
I built a set of tests for the API using SimpleTest, and everything
passes; new records are inserted fine, and all data is present.
However, when I then make calls to the API from a web application...
step 4 fails, and I get "Connection timed out" from my DB connection.
I can take the SQL created (I log it, just in case :-) and run it on the
database without error. I can even run the sequence of statements
directly on the database without error or any sort of time lapse.
I checked the environment between the CLI and apache, and the php.ini
files are the same (and I'm running them off the same machine). I even
made sure that the test case matched the data I was throwing at it from
the web -- again, the test case ran fine.
What I see when monitoring it is that after the initial queries are
passed to the database, but the connection suddenly enters sleep mode
until the connection times out. What I can't figure out is why it's
doing so.
Anybody else had an experience like this? did you resolve it?
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org