Search code examples
php.htaccesscrmerror-reporting

How Do I Enter Multiple PHP Values in .htaccess?


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.


Solution

  • 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 ^^ )