开发者

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 开发者_StackOverflow中文版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.


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜