views:

200

answers:

3

Hi,

I'm editing the .htaccess file in order to make some overwrites to my php.ini file (I don't have access to it). So far, I've added:

php_value max_execution_time 600
php_value error_reporting E_WARNING
php_value log_errors Off

The application I'm editing for (vTiger CRM) recommends that "error_reporting" is set to "E_WARNING & ~E_NOTICE". When I put in that value I end up with a Error 500. How can I add the proper error_reporting values? Thanks.

A: 

You can't use the php constants in .htaccess. They're not available in that environment. You should use the integer values that the constants represent.

fireeyedboy
+4  A: 

Using constants such as E_WARNING has no meaning outside of PHP -- and when you're writting a .htaccess file, you are "outside of PHP". (see the documentation of error_reporting, for instance)

So, you cannot use those constants, and have to use their integer values, which you can find here : Predefined Constants


The easiest way to know which value you should use, in your specific case, is to use a small PHP script to do the calculation.

For instance :

<?php
var_dump(E_ALL & ~E_NOTICE);

Will output :

int 30711

(Much easiser than going through the constants' values, and calculating yourself I suppose ^^ )

Pascal MARTIN
Thank you for spelling it out for me. Your explanation makes so much sense to me. :)
FergatROn
You're welcome :-) Have fun ! *(I have to admit, the first time I needed to do this kind of configuration, I asked myself the same question you did ^^ )*
Pascal MARTIN
A: 

Something else to consider is using ini_set() in your php script where you will have access to php constants.

ini_set('max_execution_time', '600');
ini_set('error_reporting', E_WARNING);
ini_set('log_errors', '0');

There is a page on the phpsite ini.list.php that will show you which ini directives can be set this way, and which have to be set in php.ini. (I can't post more than one link, sorry) The 3 examples you've given are all legal to change in this way.

jspash