submitted by: Snippissimo
PHP: Set MYSQL Connection Timeout Period
By default, PHP waits for 60 seconds to timeout a mySQL connection. This is way too long, and can cause PHP to timeout or hang. The easy and undocumented fix is to set the default timeout period. Luckily you can do this at runtime.
code snippet:
<?php
//Set mysql connection timeout to 5 seconds.
ini_set('mysql.connect_timeout', 5);
?>



