Anthony schrieb:
Hey all,
Here's a question for you, my hosts have told me that that one my pages,
php, was causing their server to reboot because there were too many open
connections and that they should be closed.
Now, correct me if I am wrong but I thought that the connections were closed
after a minute of inactivity.
Does this sound right? Could open connections cause their server to reboot a
lot, say 3 times in 15 minutes? If so, what can I do about it?
Any insight is welcome,
Anthony
Hi Anthony,
usually you always should issue the statement mysql_close() at the end
of each php- page. This closes the mysql connection that got opened
during the script.
In case you use the command mysql_pconnect() to connect to MySQL you
must(!!) use mysql_close() at the end as otherwise your connections
will be left open for x amount of time. How long should be defined
somewhere in the ini-files of MySQL but I'm not sure where.
Otherwise and recommended practice is the command mysql_connect() as a
means to connect to MySQL as at the end of the script the recently
opened connection gets closed automatically and no mysql_close() is
needed but, of course, still should be issued.
To answer your question whether it is possible that too many open
connections can cause a server to reboot I can't give you any input but
to me this sounds logical. Of course the definition of "how many is too
many" depends on many different things and the question how often a
reboot might be required depends on the amount of traffic you have on
your website. A lot of traffic = a lot of open connections => server
reboots sooner ;-)
HTH,
Andy