IIS6.1上的PHP错误日志文件加写入权限

这是在IIS 6.1(Build 7601:Service Pack 1)上运行的带有PHP 5.3.6的Windows 2008 R2 Standard Server

我在我的PHP.ini文件中有这些设置:

error_reporting = E_ALL & ~E_DEPRECATED log_errors = On log_errors_max_len = 1024 error_log = C:/inetpub/temp/php_errors.log 

也试过这些:

 error_log = C:\inetpub\temp\php_errors.log error_log = C:\inetpub\wwwroot\php_errors.log error_log = C:\windows\temp\php_errors.log 

phpinfo()报告上面显示的正确值。

但我仍然无法从PHP脚本获取任何代码写入日志文件。 我试过这个:

 error_log("Database not available!", 0); 

甚至这个:

 asd(); 

这可能是一个权限问题,因为我也不能写任何使用fwrite:

 $fp = fopen('MyErrors.txt', 'a'); // this should go into the same directory // as my script but it, too, is not writing fwrite($fp, "Error Msg ". $emsg . "\n"); fclose($fp); 

我将权限设置到我正在编写错误日志的文件夹,以及我试图使用此信息编写文件的位置: http : //blog.chrismeller.com/enabling-php-write-access-on-iis

但是我仍然无法随时随地将php-errors.log或MyErrors.txt写入到我的系统中。

有任何想法吗?

两件事情..

  1. 确保你php.ini中的log_errors = On
  2. 把引号放在path"C:\inetpub\temp\php_errors.log"

🙂