Zabbix Server 4.4 Installation Ubuntu 18.04 #zabbix
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?
<?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.
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.
- This in fact works, but we're hosting a dozen of domains on this site, and really need something that is more global.
- 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.
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
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
#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
- 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: 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.
- 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.
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)
If php-fpm runs as a daemon, restart it to reload php.ini.You do not need to restart apache.