I have a question please help me. I want to connect mssql server using php, I want to set a time limit of 15 seconds. I want to check if the database is reachable in 15 sec. I tried using the following code but not working. I dont want to do this by doing server level changes in php.ini file. I want to do this by php only.
ini_set('mssql.connect_timeout',15);
connection = mssql_connect($_POST['DB_HOST'],$_POST['DB_USER'],$_POST['DB_PASS']);
if(!$connection) {
throw new Exception('Unable to connect database');
} else {
$database = mssql_select_db($_POST['DB_NAME'], $connection);
if(!$database) {
throw new Exception('Unable to select database');
} else {
echo "Connected";
}
}