Hi everyone,
I keep getting this error coming up:
PHP Warning: mssql_connect() Unable to connect to server: localhost,2168
However it seems that it is only coming up when there is a heavy load on the server. To explain, I have setup a PHP page which runs a small C# app that is multithreaded, which runs about 80 threads simultaneously, each one loading a PHP page which connects to the database. When I run it I get about 20 errors saying that it is unable to connect.
I have done some tests and it seems to run fine if I only have about 30 threads running, but if I run 2 windows (ie 60 threads) it produces errors.
Here is my php.ini file relating to MSSQL:
[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = Off
; Maximum number of persistent links. -1 means no limit.
mssql.max_persistent = -1
; Maximum number of links (persistent+non persistent). -1 means no limit.
mssql.max_links = -1
; Minimum error severity to display.
mssql.min_error_severity = 10
; Minimum message severity to display.
mssql.min_message_severity = 10
; Compatibility mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
; Connect timeout
mssql.connect_timeout = 10
; Query timeout
mssql.timeout = 30
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textlimit = 4096
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textsize = 4096
; Limits the number of records in each batch. 0 = all records in one batch.
mssql.batchsize = 0
; Specify how datetime and datetim4 columns are returned
; On => Returns data converted to SQL server settings
; Off => Returns values as YYYY-MM-DD hh:mm:ss
;mssql.datetimeconvert = On
; Use NT authentication when connecting to the server
mssql.secure_connection = Off
; Specify max number of processes. -1 = library default
; msdlib defaults to 25
; FreeTDS defaults to 4096
mssql.max_procs = -1
; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
;mssql.charset = "ISO-8859-1"
My setup is:
Windows Server 2003 SP2
SQL Server 2005 Express
PHP 5.2.0
IIS 6
Using the ntwdblib.dll extension
I assume that MSSQL can handle much more than 60 simultaneous connections to the database, and PHP looks like it is not limiting the connections either. Is there something else vital I am missing in this whole thing? Any help is much appreciated, thanks
Dylan