如何让php错误在syslog上显示 [英] how to get php errors to show on syslog

查看:134
本文介绍了如何让php错误在syslog上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计划在crontab上运行的脚本。我注意到我无法在任何地方看到php错误。我想能看到/ var / log / syslog或其他地方记录的php错误。我已经尝试配置我的php.ini记录错误在/var/log/php-errors.log,检查权限,并重新启动apache服务仍然没有日志。

解决方案

有两个问题需要考虑:



首先,PHP CLI使用不同于php.ini的PHP Apache的。确保您在CLI版本中编辑 error_log



其次,请确保您的日志文件可写运行cron的用户通常日志文件不能由用户帐户写入,因此您可能需要编辑权限。


I have a script which is scheduled to run on crontab. I noticed that I could not see php errors anywhere. I wanted to be able to see php errors logged on /var/log/syslog or some place else. I have tried configuring my php.ini to log the errors on /var/log/php-errors.log, checked permissions and restarted the apache service still no logs.

解决方案

There are two issues to consider:

First, PHP CLI uses a different php.ini than the version of PHP that runs via Apache. Make sure you are editing the error_log in the CLI version.

Second, make sure your log file is writable by the user that runs cron. Usually the logfile is not writable by your user account, so you may need to edit permissions.

这篇关于如何让php错误在syslog上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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