MS SQL (SQL Server) access to instances requires a static port for Linux or IBM i connections



Attempts to connect PHP to a named instance fail for operating systems other than Windows.


PHP running on any operating system other than Windows.


In Windows, setting up a connection to an MS SQL (SQL Server) named instance can be accomplished using the instance name. For example, an instance named INSTANCE1 found at IP address might be specified like this:

$servername = '\INSTANCE1';

$mssql_conn = mssql_connect($servername,"user","password");

Versions of PHP that do not run on Windows (like Linux and IBM i) cannot use the named instance to connect to MS SQL. Instead, MS SQL needs to be configured to use a different port for each instance, so you can use that port to make the connection. For example, the default instance of MS SQL is typically at port 1433, so to connect to the default instance:

$servername = '';

If named instance INSTANCE1 was at port 1435, your connection server would look something like this:

$servername = '';

Work with your MS SQL administrator to learn the port for the needed instance, and then connect to that port. MS SQL may be configured to assign a port dynamically, in which case the MS SQL configuration would need to be changed by your MS SQL administrator to assign a static port for this instance, to give you an unchanging port number you can use in your script.

Instructions for how to configure a SQL Server instance to listen on a specific port can be found here:

Configure a Server to Listen on a Specific TCP Port



Have more questions? Submit a request


  • Avatar
    Tia Briggs

    In the event that you can't get into the regulatory apparatuses, then uninstall and reinstall. When you put in the administration pack setup will offer to do the proportional consequently - simply say yes. website explainer video to explain. On the off chance that you've not introduced SP2 yet, you may very well escape with running the upgrade and noting that same incite.

  • Avatar
    Richard Morton

    I love reading this engaging in an article, for the most part since it conjures my interests! I truly need to share this on buy dissertation for others to get amuse from it also! It was one truly astonishing read and I am grateful to you for imparting it to us!

  • Avatar
    Sarah Sarah

    Hi i find you from Google you have done really good post.

  • Avatar
    umer ali

    I am umer and I am learning programming languages since 10 years I work on many Languages and I saw How technology is developing Day by day and This article is very informative for us.professional Web designer at

  • Avatar
    Morghana Chavez

    If you can't get into the administrative contraptions, then uninstall and reinstall. When you put in the organization pack setup will offer to do the corresponding therefore - basically say yes. [url=]Dissertation Help - Dissrtation Club[/url] written if you've not presented SP2 yet, you might just escape with running the overhaul and noticing that same affect.

  • Avatar
    Collie davison

    I cherish perusing this participating in an article, generally since it invokes my interests! I genuinely need to share this on purchase exposition for others to get divert from it too! It was one really surprising read and I am appreciative to you for bestowing it to us write my essay 4 me!

  • Avatar
    Klinger kl

    SQL, a quirky names for a malign skill, but one that leftovers significant to this day. It is the verbal communication which forms the foundation of your web request sending and attractive data concerning your clientele, Assignment Assistance | purchases, traffic and website actions to and from your folder. Today’s digitalized world with huge amounts of data being gather every day and stored into a file, knowing how to agenda with SQL is very important.

Powered by Zendesk