RE: Question on Connecting to Microsoft SQL Server from PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> All:
>
> I can't seem to connect to a SQL Server database with PHP. I have read the
> php.net documentation and so many other forums on the Internet that my
> eyes were literally blood shot. Today I thought I would try this route.
>
> I have PHP and Apache installed on my local machine. They work fine as I
> created another application with them (and MySQL) that worked as
> expected/designed. I want to connect to MS SQL Server 2000 that rests on
> another machine here at work. I can reach the tables and do whatever I
> want with them from my machine through SQL Query Analyzer. (The other
> machine runs a Windows Server. So I am trying to connect from one Windows
> box to another Windows box.) So I know that I can connect to the tables
> (and the machine that they rest on) from my machine. It is just that I get
> the following error when I load my PHP page: "Warning: mssql_connect() [[
> http://localhost/development_files/ordertrackno/where_is_it.php/fu
> nction.mssql-connect
> ]function.mssql-connect]: Unable to connect to server: . . . "
>
> In my PHP page I have the following:
> $sql = mssql_connect ("xx.xx.xx.xx:xxxx", "xx", "xxxxxx");
> $conn=mssql_select_db("xx", $sql);
> etc
>
> I have tried replacing the semicolon with a comma as some have said. I get
> the same error. I have tried replacing the quotation marks with an
> apostrophe and I get the same error.
>
> I have the Client tools installed on my machine. (I should mention that
> they are not installed on the Apache on my machine as I could not get them
> to install from the SQL Server disk to that location--only to the
> hardrive.). Again, they connect to the database. I can query the database
> from my machine. I have the latest ntwdblib.dllinstalled in the php,
> php\extension, apache\bin, and system 32 directories.
>
> What else . . .
>
> I have tried setting the msssql.secure_connection to both off and on and I
> still get the same error.
>
> I have ensured that TCP/IP and Named Pipes are enabled in the SQL
> Configuration tool.
>
> I have asked the network guy to help out but no luck there.
>
> Again, I am at a loss and need to get this up and running. Any suggestions
> would be appreciated.
> > Thanks.
>
> Tommy
>

Do you have any firewall software running on your local PC? (e.g. ZoneAlarm)
This could be blocking the connection from Apache but allowing it for your
other SQL client tools...

Edward

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux