Home >Backend Development >PHP Tutorial >php联接sql server 2008连不上呀

php联接sql server 2008连不上呀

WBOY
WBOYOriginal
2016-06-13 11:34:371022browse

php连接sql server 2008连不上呀!
操作系统是win server 2008 r2,数据库是sql server 2008,PHP Version 5.4.14,
在输出的phpinfo当中看
-------------------------------------------------
PDO support enabled
PDO drivers mysql, sqlite, sqlsrv

但是想使用sqlsrv访问数据库就是不行,始终出现“HTTP 错误 500.0”提示,
-------------------------------------------------
模块 FastCgiModule
通知 ExecuteRequestHandler
处理程序 PHP54_via_FastCGI
错误代码 0x00000000


这是访问的操作码,其实是从microsoft driver for PHP for sql server上拷贝的例程:

<br /><?php<br />/* Specify the server and connection string attributes. */<br />$serverName = "(local)";<br />$connectionInfo = array( "Database"=>"myDB1");<br /><br />/* Connect using Windows Authentication. */<br />$conn = sqlsrv_connect( $serverName, $connectionInfo);<br />if( $conn === false )<br />{<br />     echo "Unable to connect.</br>";<br />     die( print_r( sqlsrv_errors(), true));<br />}<br />else<br />     echo "great! </br>";<br />?><br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn