更改PHP记录语法错误的位置 [英] Changing where PHP logs syntax errors
问题描述
我将如何更改PHP记录语法错误的位置?我有多个人在同一台服务器上工作,并且我希望能够将自己的日志发送到自定义文件,这样我就不会查看其他每个人的错误.
How would I go about changing where PHP logs it's syntax errors? I've got multiple people working on the same server, and I want to be able to send my own logs to a custom file so that I'm not looking at every one else's errors.
我可以这样做:
error_reporting(E_ALL);
ini_set('display_errors','On');
ini_set('error_log','path/to/mylogfile.log');
这对于某些错误有效,但是对于实际语法错误,日志仍被发送到主目录/var/log/httpd/error_log.如何使语法错误发送到我的自定义日志文件?
And that works for some errors, but for actual syntax errors, the logs are still being sent to the master /var/log/httpd/error_log. How do I make the syntax errors get sent to my custom log file?
推荐答案
由于无法正确分析文件,因此不会执行 ini_set
函数,新的错误日志集也不会被执行.您需要在 .htaccess
文件或全局服务器配置中设置 php_value error_log/path/to/myfile.log
(假设您使用的是Apache)
Since the file cannot be correctly parsed, the ini_set
function is not executed either and neither is the new error log set. You need to set php_value error_log /path/to/myfile.log
in an .htaccess
file or the global server config (I'm assuming that you're using Apache).
这篇关于更改PHP记录语法错误的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!