Page 1 of 1

PHP + MSSQL

Posted: Sat Mar 07, 2009 5:28 am
by Batric
Hello,

I am trying to run PHP+MSSQL application. Don't ask me why, it has to be that way :D

The PHP files are on my local machine, and the MSSQL database on a windows web server. From that side I believe everything is OK.

But the problem is in my local PHP settings.

I did the following:

1) uncommented the lines: "extension=php_mssql.dll" and "extension=php_pdo_mssql.dll" in all kinds of php.ini files found in my XAMPP folder
2) downloaded "ntwdblib.dll" file and put it into php folder

But there is still no success.

Is there any additional setup or configuration to be done, so the PHP in my localhost can communicate with MSSQL database on a web server?
Anyone with similar experience? How did you solve the problem?

I'm using XAMPP lite 1.6.8

Thank you in any case :D

Batric

Re: PHP + MSSQL

Posted: Sun Mar 08, 2009 8:15 pm
by Benjamin
Batric wrote:Is there any additional setup or configuration to be done, so the PHP in my localhost can communicate with MSSQL database on a web server?
Have you specified the address of the remote server in myssql_connect()?

http://us2.php.net/manual/en/function.mssql-connect.php

Is the mssql extension installed correctly? Is it able to connect? What error are you receiving?

Re: PHP + MSSQL

Posted: Tue Mar 10, 2009 1:06 pm
by Batric
Thanks for the answer

This was the error:

Code: Select all

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: chartdemo.db.4022837.hostedresource.com in E:\www\htdocs\test\DBConn.php on line 12
 
Warning: mssql_select_db() [function.mssql-select-db]: Unable to connect to server: (null) in E:\www\htdocs\test\DBConn.php on line 13
 
Warning: mssql_select_db() [function.mssql-select-db]: A link to the server could not be established in E:\www\htdocs\test\DBConn.php on line 13
Could not connect
I just tried installing the whole application on another machine - and it worked.

The only difference was that on the other machine was installed MSSQL 2008.

Maybe that somehow enabled it.

Thanks in any case for help