开发者

How do I isolate unwanted PHP error messages?

I am using wamp and need to know why I am getting server error messages appear in all browsers. (see grab). I have turned error display off in php.ini and cannot see anywhere in the httpd.conf file that would be displaying these. I would appreciate some help as to how I can troubleshoot this problem. If anyone requires further code or information, I would be happy to supply at fiddle.

I am using php5.3.5 and ap开发者_如何学编程ache 2.0.53.

Thanks

How do I isolate unwanted PHP error messages?


display_errors is changeable PHP_INI_ALL (documentation).

This means it can be enabled in .htaccess, or in a running script using ini_set(). Check your .htaccess files; note that the server (in default config) checks .htaccess files in parent directories as well - so if your site is in /var/www/example.com/htdocs, check for .htaccess in each of the directories in this path.


Are you sure display_errors isn't being set at runtime by some function in your code? ini_set can be used to set that value at runtime, as shown in this PHP doc example:

<?php
echo ini_get('display_errors');

if (!ini_get('display_errors')) {
    ini_set('display_errors', 1);
}

echo ini_get('display_errors');
?>


i have turned error display off in php.ini

Did you check that the php.ini file you changed/checked was the one PHP is using? (shown by phpinfo())

Did you restart the webserver after changing the php.ini file?

What grab? If the q's above don't resolve your problem please provide the text of the error message.


looks like you are using zend framework. if you do not want to show error messages. (anyway turning off errors won't fix them)

option 1. change application environment. edit your bootstrap file (in public directory) find following lines

defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

to following

defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

option 2. edit your application.ini (in application/configs directory) file. change all phpSettings.display_errors=1 to phpSettings.display_errors = 0.

anyway I recommend using option 2.

but remember turning off errors won't fix them. if you post your code may be we can help.


From the OP's comment:

In php info file, display_errors is shown as on. In the php.ini file it is disabled: ;display_errors = On. why is this happening. I have checked for multiple ini files, but can only see the 1.

If the option is commented out in php.ini, it's not disabled: it means "use default". IIRC, the default here is On. Add the line display_errors = Off to php.ini.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜