I'm a bit stumped at the moment. I've been trying to get PHP to connect to an instance of SQL 2005 Express running on my PC but have had no luck.
I've tried using mssql_connect and it says it's unable to connect. The server is configured to use port 2301.
It throws back: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: XPP050815,2301
I'm at a loss on this front, so I tried the new php_sqlsrv.dll released by MS and followed a code example:
This fails to work either - it reckons somehow that the connection string is invalid.
Anyone got any ideas?
I've tried using mssql_connect and it says it's unable to connect. The server is configured to use port 2301.
Code:
$dbConn = mssql_connect("Servername,2301", "myUsername", "myPassword")
It throws back: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: XPP050815,2301
I'm at a loss on this front, so I tried the new php_sqlsrv.dll released by MS and followed a code example:
Code:
<?php
/* Specify the server and connection string attributes. */
$serverName = "(XPP050815,2301)";
/* Get UID and PWD from application-specific files. */
$uid = ("username");
$pwd = ("password");
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>"induction");
/* Connect using SQL Server Authentication. */
if( !( $conn = sqlsrv_connect( $serverName, $connectionInfo)))
{
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>
This fails to work either - it reckons somehow that the connection string is invalid.
Anyone got any ideas?