呵呵,刚才确实是那样的哈! 现在装成5.3啦,又下载了microsoft driver for PHP for sql server,终于不出错http500啦! 就是5.3的ini文件和5.4的差别很大,不但要填键值,还要添加键名称
呵呵,刚才确实是那样的哈! 现在装成5.3啦,又下载了microsoft driver for PHP for sql server,终于不出错http500啦! 就是5.3的ini文件和5.4的差别很大,不但要填键值,还要添加键名称那问题是否解决?
Unable to connect. Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 2 [code] => 2 [2] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. [message] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 2 [code] => 2 [2] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )------------------------------------------------------------------------------------------ 唉,又浪费俩小时,还是不行呀!找到问题了,但是不知道怎么解决的! 我用的微软的web platform install安装PHP,它会自动安装一个SQL server 2012 native client的软件。只要把它卸载了,PHP就再也无法运行了,即使装了fastcgi也没用。但是装了它以后,我的sql server 2008数据库就肯定是连不起来的。可以加分加到100粉的,请大侠再给看下吧!
只有这个?
你单写一个程序
<?php
var_dump(function_exists('sqlsrv_connect'));
看看输出什么
输出的是HTTP 错误 500.0 - Internal Server Error呀!
难道装的PHP没装对?因为是server2008系统,所以用的是微软那个web platform installation安装的PHP 5.4,确实没找到system32下的fcgiXXX.dll,但是phpinfo()又能输出信息。
PDO
---------------------------------------
PDO support enabled
PDO drivers mysql, sqlite, sqlsrv确实只有这几个呀!是不是还要安装啥呢?
单独一句
var_dump(function_exists('sqlsrv_connect'));
这么可能是 HTTP 错误 500.0 - Internal Server Error
至多是 bool(false)
现在装成5.3啦,又下载了microsoft driver for PHP for sql server,终于不出错http500啦!
就是5.3的ini文件和5.4的差别很大,不但要填键值,还要添加键名称
现在装成5.3啦,又下载了microsoft driver for PHP for sql server,终于不出错http500啦!
就是5.3的ini文件和5.4的差别很大,不但要填键值,还要添加键名称那问题是否解决?
Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 2 [code] => 2 [2] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. [message] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 2 [code] => 2 [2] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )------------------------------------------------------------------------------------------
唉,又浪费俩小时,还是不行呀!找到问题了,但是不知道怎么解决的!
我用的微软的web platform install安装PHP,它会自动安装一个SQL server 2012 native client的软件。只要把它卸载了,PHP就再也无法运行了,即使装了fastcgi也没用。但是装了它以后,我的sql server 2008数据库就肯定是连不起来的。可以加分加到100粉的,请大侠再给看下吧!
微软太自私了,明显是想让P(拍)H(黄)P(片)的饿死呀!!!
用sqlsrv 3.0 ,2.0的没有试过,方法是
php.ini 加入
extension=php_pdo_sqlsrv_54_nts.dll
extension=php_sqlsrv_54_nts.dll数据库链接:
$conn= new PDO("sqlsrv:server=127.0.0.1;database=abc","user","123456") or die ("PDO Connection faild.");
大侠,我用你这个语句测试是bool(true),
但是打开连接测试的页面却是空白,没有任何信息展示,这个怎么破啊。