7

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 (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?

2
  • 1
    You should always be able to change display_errors via ini_set() Commented Mar 24, 2011 at 3:56
  • Do you have access to httpd.conf or at least to configuration of virtual hosts? Commented Mar 24, 2011 at 3:57

2 Answers 2

1

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?

Sign up to request clarification or add additional context in comments.

6 Comments

I am able to set the display_errors using ini_set(). You're right, It just don't show the parse errors. If I am doing it in the .htaccess, I can see them.
I am managing i with a git,with three (dev/test/production) branches. I even want to handle the .htaccess file with it.
@Dennis If you have three branches, why not have the different .htaccess files in each branch?
To avoid mistakes during the merging. if I change something in the .htaccess of the dev, it must pass thought all branches.,,
@Dennis It shouldn't if you change and commit it in dev, then merge the other branches and change and commit.
|
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.