Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question
    
Add: <?php phpinfo(); ?> to phpinfo.php the same place as your domain's document root and view it in your browser. You can then see how PHP is being executed (whether as CGI or module), what php.ini configuration files are being included, including their path. It's possible you may have another php.ini overwriting /etc/php.ini, or /etc/php.ini isn't being included at all. –  laebshade Jan 7 '12 at 3:57
add comment

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
    
This in fact works, but we're hosting a dozen of domains on this site, and really need something that is more global. –  Keefer Jan 6 '12 at 12:37
    
This is what I am using until my web host replies to my queston about why the /etc/php.ini directives aren't being regarded. –  Keefer Jan 6 '12 at 13:20
add comment

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
share|improve this answer
    
I opened a ticket last night before I left work. No answer yet. Once again, stackexchange is more responsive. I don't know for a fact that the new server had LiteSpeed or even + suPHP The bits I was adding to php.ini and .htaccess were all things I was finding via Google. –  Keefer Jan 6 '12 at 13:19
    
@Keefer: if your hosting is not responding withing 24 hours you must change hosting! There are millions of hosters on the internet. Your issue seems to be a generic problem that's why you find suggestions, but you might incurr in future in a specific server configuration issue where you won't find any help on the web. –  Marco Demaio Jan 7 '12 at 12:18
    
you have no idea.. We're looking into new hosting. We're in the process of migrating from one server on that web host to another, but everything falls out of the scope of support. We don't have a webmaster/sys admin on staff. I'm sadly the closest thing we have, and we're willing to pay a web host to have support for technical questions such as this. As soon as this migration is complete, and things calm down, I'll be researching new web hosts. –  Keefer Jan 9 '12 at 22:05
add comment

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)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.