I have the following environment on one server:
For the development environment I would like to see all PHP errors (including parse errors). Unfortunately the PHP configuration is quite strict. It does not allow to set the display_errors within the PHP file. It means that
ini_set("display_errors", 1);
and all variants of it are not working. The following works fine within the .htassess file:
php_flag display_errors "1"
Thus, my idea was to do something like this:
if(HOST==dev.domain.com) {
php_flag display_errors "1"
}
I tried SetEnvIf, RewriteCond, IfDefine and other variants, but without success.
Is there somehow a way to do it?
The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>
As I mentioned in my comment, you can set display_errors
using ini_set()
. However, it won't help with parse errors as noted in the manual
Can you make changes to the VirtualHost sections for each site? If so, add the php_flag
in there.
If not, why not just have a different .htaccess
file per site?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With