简体   繁体   English

PHP关闭所有错误但将错误保存到error_log

[英]PHP turn off all errors but save errors to error_log

I'm on a shared hosting and want to hide all errors from the visitors so I use error_reporting(0) but this will lead to erros not saving in the error_log file that's created in the directory where the file is located. 我在共享主机上并希望隐藏访问者的所有错误,因此我使用error_reporting(0)但这将导致错误不保存在文件所在目录中创建的error_log文件中。 How to turn off erros but add them to the error_log? 如何关闭错误但将它们添加到error_log?

Tried display_errors,0 but it seems my shared host is not allowing the edit of ini 试过display_errors,0但似乎我的共享主机不允许编辑ini

Thanks 谢谢

ini_set("display_errors", 0);
ini_set("log_errors", 1);

//Define where do you want the log to go, syslog or a file of your liking with
ini_set("error_log", "syslog");

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

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