
: 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
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?
More posts by @Vandalay111
3 Comments
Sorted by latest first Latest Oldest Best
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)
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.