bbeer Posted June 23, 2014 Share Posted June 23, 2014 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 More sharing options...
DaveP Posted June 23, 2014 Share Posted June 23, 2014 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 More sharing options...
bbeer Posted June 23, 2014 Author Share Posted June 23, 2014 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 2 Link to comment Share on other sites More sharing options...
DaveP Posted June 23, 2014 Share Posted June 23, 2014 So long as you can navigate around your site, then everything is fine. It looks as if your hoster changed some Apache settings as well as upgrading PHP. Link to comment Share on other sites More sharing options...
Craig Posted June 23, 2014 Share Posted June 23, 2014 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> 5 Link to comment Share on other sites More sharing options...
ryan Posted June 23, 2014 Share Posted June 23, 2014 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. 1 Link to comment Share on other sites More sharing options...
SiNNuT Posted June 23, 2014 Share Posted June 23, 2014 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 More sharing options...
bbeer Posted June 24, 2014 Author Share Posted June 24, 2014 Thanks Guys yes the module was missing. however he installed it afterwards. Thanks again for your help. Link to comment Share on other sites More sharing options...
Beluga Posted January 1, 2015 Share Posted January 1, 2015 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 More sharing options...
Pete Posted January 1, 2015 Share Posted January 1, 2015 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 Link to comment Share on other sites More sharing options...
Beluga Posted January 1, 2015 Share Posted January 1, 2015 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 More sharing options...
Pete Posted January 1, 2015 Share Posted January 1, 2015 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 More sharing options...
Beluga Posted January 2, 2015 Share Posted January 2, 2015 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now