我正努力解决此问题,但我不能。我下载了php 7.2.8的驱动程序,并将其放在php/ext
文件夹中,并在php.ini
中定义了它
extension=php_sqlsrv_72_ts.dll
extension=php_pdo_sqlsrv_72_nts.dll
extension=php_sqlsrv_72_nts.dll
extension=php_pdo_sqlsrv_72_ts.dll
,它仍然无法正常工作。我的代码是
<?php
$serverName = "DESKTOP-DA3ICN8\ELMASRY"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "database'=>'elmasry");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
} else {
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>