简体   繁体   English

PHP error_log:不会写入指定的文件

[英]PHP error_log: Won't write to specified file

Running PHP under IIS on my Win XP Pro system. 在我的Win XP Pro系统上的IIS下运行PHP。 I cannot debug my scripts easily because get PHP to write to the error log I specify. 我无法轻松调试我的脚本,因为让PHP写入我指定的错误日志。 Here are the relevant (I think) php.ini entries: 以下是相关的(我认为)php.ini条目:

error_reporting  =  E_ALL & E_STRICT
display_errors = Off
log_errors = On
error_log = "c:/php5/log/php.log"

I had the slashes going the Windows/DOS way before. 我以前用斜线进入Windows / DOS方式。 In either case, it did not write to the file php.log in that directory. 在任何一种情况下,它都没有写入该目录中的文件php.log。 The log file is writable by IUSR_SERVERNAME, the directory is writable by IUSR_SERVERNAME, the parent directory is writable by IUSR_SERVERNAME. 日志文件可由IUSR_SERVERNAME写入,该目录可由IUSR_SERVERNAME写入,父目录可由IUSR_SERVERNAME写入。 I'm sure I'm missing something stupid. 我敢肯定我错过了一些愚蠢的东西。

Any tips? 有小费吗?

Have you tried in the php file itself? 你试过php文件吗?

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', "c:/php5/log/php.log");

Update: The problem is that you are using a bitwise AND where you should use a bitwise OR 更新:问题是您使用按位AND,您应该使用按位OR

Try this 试试这个

var_dump(E_ALL);
var_dump(E_STRICT);
var_dump(E_ALL | E_STRICT);
var_dump(E_ALL & E_STRICT);

output: int(6143) int(2048) int(8191) int(0) output:int(6143)int(2048)int(8191)int(0)

So basically you are writing 所以基本上你在写作

error_reporting  =  0

Effectively turning off the error reporting. 有效关闭错误报告。 Change the & for an | 更改&为| in your php.ini and you should be ok. 在你的php.ini中你应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM