October: Mod Rewrite is enabled (XAMPP) but web installer says it's not

Created on 6 Aug 2018  路  9Comments  路  Source: octobercms/october

Hello,

I have enabled Mod Rewrite on XAMPP but I am getting this error "PHP mod_rewrite module is required". Can anybody help me with that?

LoadModule rewrite_module modules/mod_rewrite.so (Check loaded with phpinfo())

Directory settings updated:
AllowOverride All
Require all granted

Thanks for the help!

Medium Completed

Most helpful comment

@didiervassout do what @leonaze did in #3708 and just remove the test for now. The test requires that the server environment allows you to use SetEnv.

All 9 comments

I am on LAMP stack but having same issue. My apache2 mod_rewrite is enabled but getting mod_rewrite error at requirement check page.

@wertykid I think, I have found a way to fix.

I have changed line 103 in install_files/php/installer.php as follows

$result = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) || in_array('mod_rewrite', apache_get_modules());

@wertykid @mrlinnth Detecting proper support for the presence of mod_rewrite when using Apache seems to be quite the problematic issue.

The current implementation uses SetEnv in the .htaccess file and checks $_SERVER, which should be reliable enough but technically requires FileInfo to be an allowed override, either with AllowOverride: all or AllowOverride: FileInfo. We could perhaps use getenv() instead of checking $_SERVER directly, that might improve the reliability. See https://stackoverflow.com/questions/5764469/zend-setenv-in-htaccess-not-working for reasons why the SetEnv and $_SERVER approach might not be working for you.

Using apache_get_modules() as the solution won't work because https://github.com/nette/examples/issues/17 and that particular approach only checks to see if it is enabled for PHP, not if the .htaccess file actually works, which is what the purpose of that check is.

@mrlinnth could you please test using getenv('HTTP_MOD_REWRITE') instead of array_key_exists('HTTP_MOD_REWRITE', $_SERVER)?

@LukeTowers sorry I was a stupid potato. I didn't realize I have "Show Hidden" off in my file managers and there is .htaccess file inside the installer folder. No error after I copy .htaccess to my vhost.

So I guess this might not be a bug and more like a careless user issue on my case :sweat_smile:

@wertykid you might wanna check if your xampp folder has .htaccess file or not.

@mrlinnth @LukeTowers Hey, thanks for the solutions! @mrlinnth solution worked for me, now I can install the files without issues. Cheers

@wertykid I tired copying the .htaccess file one my MAMP folder but it doesn't fix anything for me...

@LukeTowers Would you have a temporary solution in order to install it the easy way ?

@didiervassout do what @leonaze did in #3708 and just remove the test for now. The test requires that the server environment allows you to use SetEnv.

This check has been removed from the installer. The check is too opinionated (apache) and does not prevent the installer from working. Documentation is a satisfactory approach to overcome it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m49n picture m49n  路  3Comments

Flynsarmy picture Flynsarmy  路  3Comments

mittultechnobrave picture mittultechnobrave  路  3Comments

jvanremoortere picture jvanremoortere  路  3Comments

mittultechnobrave picture mittultechnobrave  路  3Comments