timeout with php-mssql connection with stunnel

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I connect to a microsoft SQL server from php.  Php is running on linux
(debian sarge) with the freetds package.
The connection is secured through stunnel (version 3.26), with stunnel
running locally on the web server and locally on the SQL server
This means php connects locally to the stunnel port, which then
establishes a secure connection to stunnel on the sql server.  There
the data is then transmitted locally to the SQL server.

When the SQL server machine is not responding the connection attempt
times out with the following msg:
Warning: mssql_connect(): Sybase: Client message: Read from SQL server
failed. (severity 78) in /var/www/abc/utils.php on line 283
Warning: mssql_connect(): Sybase: Client message: Login incorrect.
(severity 78) in /var/www/abc/utils.php on line 283
Warning: mssql_connect(): Sybase: Unable to connect in
/var/www/abc/utils.php on line 283

My problem is that the timeout is very high, about three minutes.  I
could not reduce this timeout with any parameter like
mssql.connect_timeout,  mssql.timeout, not even max_execution_time
would reduce this timeout.
I also tried to reduce the freetds and stunnel timeout, no success.

I assume that this has something to do with stunnel being used beccause
the mssql drive recives the connection response from the local stunnel.

Do you have any idea how I can set the timeout to a value of 10 sec. ?

many thanks!


Site Timeline