cannot get mssql working with sql server 2005

Posted by Ryan on Server Fault See other posts from Server Fault or by Ryan
Published on 2012-06-25T12:52:26Z Indexed on 2012/06/25 15:17 UTC
Read the original article Hit count: 163

Filed under:
|
|

I'm a MySQL/Apache user, trying my hand with IIS and SQL server, so please, if this is a stupid question have patience.

I'm using IIS version 7.5. PHP version 5.3.13 and SQL server 2005 IIS is running on port 90, not sure if that will make a difference or not. I know my sql server is running because I can explore/connect to it in Server management studio.

I know php is configured properly, because //localhost:90/phpinfo.php works fine.

I updated the php_msql.dll extension in phpinfo to: extension=ext/php_msql.dll

EDIT- However, when I run phpinfo() under the "configure command" row, this is present: --without-mssql

I found/downloaded the ntwdblib.dll and placed it in both sys32 and php root.

All these things were supposed to fix the issue, and they haven't.

This is the code I'm using, straight from php.net:

<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = 'localhost';

// Connect to MSSQL
$link = mssql_connect($server, 'uname', 'pwd');

if (!$link) {
  die('Something went wrong while connecting to MSSQL');
}
?>

obviously I'm using a real username and password, but when I load the file in my browser, I receive a 500 error. Upon checking the log, this is what is displayed:

2012-06-25 12:41:29 ::1 GET /test.php - 90 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/536.5+(KHTML,+like+Gecko)+Chrome/19.0.1084.56+Safari/536.5 500 0 0 5

That (to me) doesn't help me much. What am I doing wrong?

Thank you

© Server Fault or respective owner

Related posts about php

Related posts about sql-server-2005