PHP内置服务器错误日志位置

问题描述:

我不知道有没有?但是内置在Web服务器中的php是否还将其错误日志保存在文件中?用于拖尾的目的,例如在apache中创建虚拟主机时.

I don't know if there's any? but is php built in web server also save its error logs in a file? for tailing purposes, like when creating virtual host in apache.

更新:我正在使用Mac OSX

UPDATE: i'm using mac osx

默认情况下,内置的Web服务器不会在任何地方记录日志,因此您需要为其提供php.ini来自定义.例如,如果您创建了一个名为php.ini的文件,其内容如下:

The built-in webserver doesn't log anywhere by default, so you need to provide a php.ini for it to customise this. For example, if you created a file called php.ini with this content:

error_log = /Users/me/test.log
log_errors = on
date.timezone = UTC

然后,您可以像这样启动PHP的内置Web服务器:

Then you can start PHP's built-in webserver like this:

php -S 127.0.0.1:8080 -c php.ini

并且error_log()调用将被记录到您指定的文件中.

And error_log() calls will be logged to the file you've specified.