PHP内置服务器错误日志位置 [英] PHP built-in server error log location

查看:158
本文介绍了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.

这篇关于PHP内置服务器错误日志位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆