系統:windows 2008 r2
iis 7.5
php 5.3.1 rc1
需計要連線的ms sql server 是 2005
當我在設定 php.ini
要增加
extension=php_pdo_sqlsrv_53_ts.dll
extension=php_sqlsrv_53_ts.dll
網址就錯誤了 註解掉又正常,所以我不知道我是那邊出問題 想請大大們幫忙謝謝~
IIS的話,應該使用nts的版本就可以。
在php.ini設定log_errors=On以及error_log=檔案完整路徑,就可以把錯誤訊息寫入log檔,透過檢視這個log,應該更清楚知道問題。另外,你可以直接執行php.exe看看,會跑出什麼訊息。(執行php -i,就跟執行phpinfo()是一樣的)
通常會碰到的不外是sql server native client沒裝,或是Visual C++ redistribution套件沒裝,不過要看log才能確定。(不過我是在安裝非官方的PHP5.5 sqlsrv碰到的,所以問題可能跟你不一樣)
想請問一下,我後來就重新用過
我裝
我想連遠端的 sql 2005 server 的資料庫
不知道我那邊有錯呢 謝謝~
找到問題,是 Visual C++ 2010沒裝到@@
但目前 測試到連 mssql 一直無法連線到~~
<pre class="c" name="code">
<?php
$serverName = "遠端sql ip";//資料庫位子
$uid = "*********"; //帳號
$pwd = "*********"; //密碼
$connectionInfo = array( "UID"=>$uid,"PWD"=>$pwd,"Database"=>"資料表名稱");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn == true )
{
echo "資料庫存在";
}
else
{
echo "資料庫不存在";
}
?>
MIM REQUIREMENT 是。。。
Supported operating systems for version 3.0 of the driver include:
Windows Server 2008 R2 SP1
Windows Vista SP2
Windows Server 2008 SP2
Windows 7 SP1
Supported operating systems for version 2.0 of the driver include:
Supported operating systems for version 2.0 of the driver include:
Windows Server 2003 Service Pack 1
Windows XP Service Pack 3
Windows Vista Service Pack 1 or later
Windows Server 2008
Windows Server 2008 R2
Windows 7
PHP 5. For information about how to download and install the latest stable binaries, visit http://php.net.
Microsoft Drivers for PHP for SQL Server, version 3.0 requires PHP 5.3.0 or later. If possible, use PHP 5.3.6, or later. The version 2.0 driver works with PHP 5.2.4 or later, but not with PHP 5.4. If possible, use PHP 5.2.13, or later.
http://technet.microsoft.com/en-us/library/cc296170%28v=sql.105%29.aspx