Jump to content

Urgent Page down


bbeer
 Share

Recommended Posts

Hi All 

I have a bad problem with a page that now generates a server error 500

[Mon Jun 23 10:24:01.073666 2014] [core:alert] [pid 528306] [client 157.55.39.164:63541] //.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration

anyone any Idea what this could be?

your help is much appreciated!

 
Link to comment
Share on other sites

500 errors are almost always .htaccess related, and yours looks no different. Usual course of action is to comment out sections until you find the culprit, but from the error message you quote, this should not be difficult.

What changes did you make immediately before this problem appeared?

Link to comment
Share on other sites

Hi Dave

they've installed php 5.4 as standard since then I have that error. Now solved it by uncommenting 

# SetEnv HTTP_MOD_REWRITE On

hope that does not cause any other problems

  • Like 2
Link to comment
Share on other sites

I'm wondering if it would be worthwhile wrapping that declaration in another check, inside the current mod_rewrite check?

<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
  • Like 5
Link to comment
Share on other sites

hope that does not cause any other problems

That SetEnv line is only used by the installer to determine if mod_rewrite might be inactive. It is totally fine to remove it. 

Great suggestion by Craig to wrap it in the IfModule block–I will add that. 

  • Like 1
Link to comment
Share on other sites

The instructions in PW's .htaccess are pretty clear:

  # -----------------------------------------------------------------------------------------------
  # Set an environment variable so the installer can detect that mod_rewrite is active.
  # Note that some web hosts don't support this. If you get a 500 error, you might try
  # commenting out this SetEnv line below.
  # -----------------------------------------------------------------------------------------------

  SetEnv HTTP_MOD_REWRITE On

It appears that your hoster, apart from upgrading PHP, has also made some changes in Apache's config, in this case the mod_env module seems unavailable.

You can comment it out, because you don't need it for PW to function correctly. Of course you do need mod_rewrite.

It would indeed be better to add this to the .htaccess:

<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
Link to comment
Share on other sites

  • 6 months later...

Upgraded a PW 2.4 installation to 2.5 and got an internal server error.

In the end I realized it was because of the <IfModule mod_env.c> statement around SetEnv HTTP_MOD_REWRITE On.

So no problem with the SetEnv itself, only the IfModule.

Webhost: http://www.sigmatic.fi/

phpinfo() shows

Server API CGI/FastCGI
_SERVER["HTTP_MOD_REWRITE"] On
_ENV["HTTP_MOD_REWRITE"] On

They've disabled showing Apache's version.

I got the internal server error both with PHP 5.3.x and 5.5.x.

Link to comment
Share on other sites

Take out the ifmodule? It just checks if the module exists so if you think it does then that line can be removed along with the closing /ifmodule

Sure, that's what I said: the <IfModule mod_env.c> statement around SetEnv. Removing the statement made the internal server error disappear.

I'm not able to find out the host's entire config, so unfortunately can't give any more tips. Yet, other users are bound to hit this in the future.

I could ask the host's customer service, though, if needed.

Link to comment
Share on other sites

I would ask them - I have also seen other hosts without ifmodule support but not in a long time so suspect it might be an older version of Apache maybe or just a feature that isn't switched on on the server.

Link to comment
Share on other sites

It's not that they lack ifmodule support, there are lots of ifmodule blocks in PW's .htaccess after all.

I asked them and they said they tested a block with no other rules inside and it worked ok:

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
</IfModule>

They asked me to make an example install of PW so they could test. Essentially this would mean breaking the site, as I only have one db.. I pointed them to the htaccess.txt in PW's GitHub, but they insisted on a test instance where it goes 500 error. I don't want to confuse my client by intentionally keeping the site broken, so I gave up.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...