【发布时间】:2018-12-29 12:33:40
【问题描述】:
我有几个 php 错误出现在页面上:Notice: Undefined index
我有/etc/php/5.6/fpm/php.ini 和display_errors = Off
当我将值设置为On 时,我发现页面上的错误更多。
我的 htaccess 文件是空的,vHost conf 是:
<VirtualHost *:80>
ServerName website1.tld
DocumentRoot /home/website1
ErrorLog /var/log/sites/ website1_error_log
CustomLog /var/log/sites/ website1_access_log combined
DirectoryIndex index.php index.html index.htm index.php4 index.php5
<Directory /home/website1>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/"
</FilesMatch>
RewriteEngine on
</VirtualHost>
谢谢
【问题讨论】:
-
答案当然是修复错误而不是压制它们。
-
那么请显示出现错误的代码。不要隐藏错误,解决它们!
-
这是一个大型生产网站,我无法纠正数千个 php 错误。在旧服务器上,不显示错误
-
你改过php版本了吗? “我无法纠正数以千计的 php 错误” - 你怎么知道网站是否按预期工作?
-
@Jeto - 诸如未能分配资源或无法连接到某些 API 等错误是真正的错误,应该记录和调查 - 我可以理解。但是
Notice: Undefined index消息是草率的编码和潜在的指标,表明代码的质量通常值得怀疑。