Mobile app version of vmapp.org
Login or Join
Vandalay111

: My php.ini configuration is being ignored - how can I override the error reporting level in my PHP scripts? Just migrated to a new server, and its error reporting level for PHP is higher than

@Vandalay111

Posted in: #Configuration #Error #Php #Server #Webserver

Just migrated to a new server, and its error reporting level for PHP is higher than the server we migrated from. It's showing warnings and notes about deprecated PHP.

While obviously, the long term solution is to address the warnings, in the short term, I need to silence them from echoing from the server.

I've tried editing /etc/php.ini and restarting apache

display_startup_errors = Off

Also tried adding it to the domain's root .htaccess file. Neither place seemed to do the trick:

# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0


Hosting is with Media Temple (dv 4.0), if that matters.

Do I need to change or create a php.ini somewhere else?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

3 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

Yet another alternative:

If you have a master config file you can place the error reporting function in that file. It obviously then will affect the entire website.

Yet another alternative:

Place this in an htaccess file in the root directory of the site. Should affect every domain:

php_flag display_errors off (or whatever you want it to be)

10% popularity Vote Up Vote Down


 

@Dunderdale272

The easiest thing is to open a ticket on your new webhoster and and ask him how you could set up php.ini directives per your account.

Given the code you showed it seems you were on a server with LiteSpeed where you can use php_flag in .htaccess file.

Maybe the new server where you moved is using Apache + suPHP (and NOT LiteSpeed) in such case you would need to activates suPHP by addding this line in your .htaccess file
#Activates php.ini config located in main folder to work also recursively for all subfolders
suPHP_ConfigPath /home/your_cpanel_user_name/public_html


and then in the same folder you can add a simple php.ini file where you write inside the directives you want to override in the following format

; Overriding server's php.ini directives
error_reporting = E_ALL|E_NOTICE|E_STRICT
display_errors = Off
log_errors = On

10% popularity Vote Up Vote Down


 

@Candy875

You can use the error_reporting function at the top of each file to get round the fact that your server doesn't seem to be obeying what you've configured.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme