mssql_connect syntax when using port muber

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

Threaded View

I have a cron job successfully querying a random mssql database from
numerous servers using php cli (5.3.2) in conjunction with openvpn.

Connection strings are in the form of ip\instance. The one case where
the script doesn't work is for mssql instances that are on the other
side of an iptables box and the port number is required.

This same connection string works fine in sql management studio,
'\instance_name,10000' but not as part of mssql_connection
in my script.

$link = mssql_connect('\instance_name,10000', user, pass);

Anyone any thoughts as to why this isn't working when including a

Many thanks,


Re: mssql_connect syntax when using port muber

El 23/06/2011 18:19, chris.percol escribió/wrote:
Quoted text here. Click to load it

Some guessing... The PHP manual says that «[the MSSQL] is not available
anymore on Windows with PHP 5.3 or later.» so you must be using Linux:

In that case, you are not using the the syntax described in the manual:

resource mssql_connect ([ string $servername [, string $username [,
string $password [, bool $new_link = false ]]]] )


     The MS SQL server. It can also include a port number, e.g.
hostname:port (Linux), or hostname,port (Windows).

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Re: mssql_connect syntax when using port muber

On Jun 23, 5:36=A0pm, "=C1lvaro G. Vicario"
Quoted text here. Click to load it


Thank you for your detailed answer to my question.

I had looked at mssql_connect examples in the manual but not read the
contents properly, missing hostname: port (Linux).

Thanks again,


Site Timeline