开发者

How to enable display_errors with .htaccess

I have the following environment on one server:

  1. dev.domain.com for the development
  2. test.domain.com for the tests
  3. www.domain.com is the working production

For the development environment I would like to see all PHP errors (includ开发者_如何学JAVAing 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?


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?


Just ignore the .htaccess file within your version control system and create a separate file for each set of settings on each server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜