Sunday, March 20, 2011

How to handle php-mysql connection timeout?

How to increase time period of mysql connection timeout through php.Or how to handle php-mysql connection time out.

By default php-mysql connection timeout is 60 sec.

It is define in php.ini.

These are the steps to change it as per requirement

Step 1: Default location of php.ini file is /etc/php.ini other wise locate it.
Step 2: In php.ini file search from "mysql.connect_timeout" it is bydefault set up to 60 sec.
If you change 60 to -1 then there is no limit on connection timeout.
Step 3: Save file and exit


For other option of mysql in php.ini file you can check in php.ini file.Other location for reference is 

w3school php-mysql functions

No comments: