I am running PHP 4.3.4 and the desktop edition of Sql Server 2000 (MSDE), along with Apache2. I have enabled the mssql functions and they all work fine.

My problem is I cannot connect to the local server through php using:

$host = "localhost";
$user = "sa";
$pass = "";
mssql_connect($host, $user, $pass);

and I recieve the message:

mssql_connect(): Unable to connect to server: localhost

I have tried the actual host name and the ip address.
I've also tried connecting through port 1433.
ex.
$host = "localhost,1433"; or
$host = "localhost:1433", or
$host = "HOSTNAME:1433", or
$host = "IPADDRESS";

Non of these seem to work.

When i try this on my server at work (SQL Server 2000, PHP 4.3.4, Apache2), everything works perfectly.

Has anyone successfully connected to an MSDE server through php locally and is this possible? If so, what did you do? Thanks in advance.

    I figured it out!

    When installing MSDE, make sure that

    DISABLENETWORKPROTOCOLS=0.

    If this is not specified or set to 1 (default), network connectivity to your server is disabled, therefore not allowing anything to connect to your server, causing a lot of pointless frustration.

      2 months later

      I'm new to working on Windows - just installed the evaluation version of WinEnabler with the PHP installation, installed the MSDE SQL Server version, and cannot connect.

      Where and how can I specify the setting you indicated above?

      Thanks

        Write a Reply...