这是phpinfo输出:
version.php
以下是代码:
$serverName = "X.X.X.X";
$connection = array( "UID"=>"UserID", "PWD"=>"Password123", "Database"=>"database_name");
$conn = sqlsrv_connect( $serverName, $connection);
if ($conn === false) {
$myfile3 = fopen("log.txt", "w");
fwrite($myfile3, sqlsrv_errors());
fclose($myfile3);
};
$tsql = "SELECT top 10 pName from products";
$stmt = sqlsrv_query( $conn, $tsql);
$row = sqlsrv_fetch_array($stmt);
$myfile4 = fopen("log.txt", "w");
fwrite($myfile4, $row[0]);
fclose($myfile4);
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
没有写入日志文件.即使我在fwrite($myfile3,“硬编码文本”)中硬编码文本;地方,没有什么是写出来的.
以下是php.ini文件中的扩展部分
[ExtensionList]
;extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
extension=php_sqlsrv_7_nts_x64.dll
;extension=php_sqlsrv_7_ts_x64.dll
最后,我知道我不需要所有这些,但这些是我的ext文件夹中的4个dll.
php_sqlsrv_7_nts_x64.dll
php_sqlsrv_7_nts_x86.dll
php_sqlsrv_7_ts_x64.dll
php_sqlsrv_7_ts_x86.dll