I made a project in the codeigniter framework and uploaded it to a host, the hoster said the site was filling the logfiles of the server pretty fast.
我在codeigniter框架中创建了一个项目并将其上传到主机,主机表示该网站正在快速填充服务器的日志文件。
So I checked the error log and for every request i get:
所以我检查了错误日志和我得到的每个请求:
error_reporting() has been disabled for security reasons /index.php on line 36
set_error_handler() has been disabled for security reasons /system/core/CodeIgniter.php on line 72
I asked the host if he could turn on these options because codeigniter needs them for its error handling, but they replied with that i will have to edit my code to disable these functions on their server.
我问主机是否可以打开这些选项,因为codeigniter需要它们进行错误处理,但他们回复说我必须编辑我的代码才能在他们的服务器上禁用这些功能。
I don't want to edit core files of codeigniter, and i don't really get why it is disabled. Do any of you know an easy solution to fix this error, or some arguments to tell the hoster to change this setting for me?
我不想编辑codeigniter的核心文件,我真的不明白为什么它被禁用。你们中的任何人都知道一个简单的解决方案来解决这个错误,或者一些参数告诉主持人为我改变这个设置吗?
1 个解决方案
#1
0
The reason that the error_reporting
feature may be disabled by a web host is to prevent faulty PHP programs from outputting crash messages to the end user that could be used by a hacker to work out how to gain access to the server. PHP crash messages contain a number of details that may be useful to hackers, including directory paths and information about the framework software being used.
Web主机可能禁用error_reporting功能的原因是为了防止错误的PHP程序向最终用户输出崩溃消息,黑客可以使用该消息来确定如何获取对服务器的访问权限。 PHP崩溃消息包含许多可能对黑客有用的细节,包括目录路径和有关正在使用的框架软件的信息。
It is generally considered good practice to disable error reporting for a production site, so that these messages to not get shown to end users. Switch it on for development, and off for production.
通常认为禁用生产站点的错误报告是一种好习惯,这样这些消息就不会显示给最终用户。将其打开以进行开发,然后关闭以进行生产。
This explains why your host has disabled it.
这解释了您的主机禁用它的原因。
As for how to prevent the "error reporting disabled" messages going into the log: Well, unfortunately, you can't, unless you edit the code to remove the references to error_reporting
.
至于如何防止“错误报告禁用”消息进入日志:嗯,不幸的是,你不能,除非你编辑代码删除对error_reporting的引用。
The CodeIgniter manual contains this page: http://ellislab.com/codeigniter/user-guide/general/errors.html
CodeIgniter手册包含此页面:http://ellislab.com/codeigniter/user-guide/general/errors.html
On this page, it states that the error_reporting
code is in index.php
, and they encourage you to edit it to stop it reporting errors once your code is in production.
在此页面上,它指出error_reporting代码位于index.php中,并且它们鼓励您编辑它以在代码生产时停止报告错误。
In other words, CodeIgniter says: "please do change this". So don't worry about not wanting to change the core files (index.php
isn't really a core file anyway).
换句话说,CodeIgniter说:“请改变这个”。所以不要担心不想更改核心文件(无论如何,index.php并不是真正的核心文件)。
#1
0
The reason that the error_reporting
feature may be disabled by a web host is to prevent faulty PHP programs from outputting crash messages to the end user that could be used by a hacker to work out how to gain access to the server. PHP crash messages contain a number of details that may be useful to hackers, including directory paths and information about the framework software being used.
Web主机可能禁用error_reporting功能的原因是为了防止错误的PHP程序向最终用户输出崩溃消息,黑客可以使用该消息来确定如何获取对服务器的访问权限。 PHP崩溃消息包含许多可能对黑客有用的细节,包括目录路径和有关正在使用的框架软件的信息。
It is generally considered good practice to disable error reporting for a production site, so that these messages to not get shown to end users. Switch it on for development, and off for production.
通常认为禁用生产站点的错误报告是一种好习惯,这样这些消息就不会显示给最终用户。将其打开以进行开发,然后关闭以进行生产。
This explains why your host has disabled it.
这解释了您的主机禁用它的原因。
As for how to prevent the "error reporting disabled" messages going into the log: Well, unfortunately, you can't, unless you edit the code to remove the references to error_reporting
.
至于如何防止“错误报告禁用”消息进入日志:嗯,不幸的是,你不能,除非你编辑代码删除对error_reporting的引用。
The CodeIgniter manual contains this page: http://ellislab.com/codeigniter/user-guide/general/errors.html
CodeIgniter手册包含此页面:http://ellislab.com/codeigniter/user-guide/general/errors.html
On this page, it states that the error_reporting
code is in index.php
, and they encourage you to edit it to stop it reporting errors once your code is in production.
在此页面上,它指出error_reporting代码位于index.php中,并且它们鼓励您编辑它以在代码生产时停止报告错误。
In other words, CodeIgniter says: "please do change this". So don't worry about not wanting to change the core files (index.php
isn't really a core file anyway).
换句话说,CodeIgniter说:“请改变这个”。所以不要担心不想更改核心文件(无论如何,index.php并不是真正的核心文件)。