bollo
bollo

Reputation: 1634

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 apache 2.0.53.

Thanks

enter image description here

Upvotes: 3

Views: 337

Answers (5)

Piskvor left the building
Piskvor left the building

Reputation: 92772

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.

Upvotes: 1

pahan
pahan

Reputation: 2453

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.

Upvotes: 1

Piskvor left the building
Piskvor left the building

Reputation: 92772

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.

Upvotes: 2

user456814
user456814

Reputation:

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');
?>

Upvotes: 2

symcbean
symcbean

Reputation: 48367

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.

Upvotes: 1

Related Questions