我刚开始在我工作的网站的前端和后端(使用 Wordpress)收到一些警告。使用位于 wp-config.php 文件开头的 error_reporting(0);
关闭错误报告。我也尝试将其放入主 index.php 文件中,但无济于事。
警告今天才开始出现,而且它们没有出现在网站的实时版本中,至少 99% 的代码相同,数据库相同。
以下是错误(domain.com 的替换域名):
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/virtual/domain.com/:/usr/share/php/) in /var/www/virtual/domain.com/htdocs/wp-includes/functions.php on line 2104
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/virtual/domain.com/:/usr/share/php/) in /var/www/virtual/domain.com/htdocs/wp-includes/functions.php on line 2095
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/virtual/domain.com/:/usr/share/php/) in /var/www/virtual/domain.com/htdocs/wp-includes/functions.php on line 2104
为什么我会收到这些消息? error_reporting(0)
不应该关闭所有警告吗?
最佳答案
尝试:
ini_set("display_errors", "off");
但是,根据您的主机,您可能无法像这样动态更改 ini 设置。
关于尽管错误报告被关闭,PHP 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14643878/