GetSimple Support Forum
[SOLVED] Root .htaccess not created when installing (on some servers) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: GS Development Testing - (alpha/beta) (http://get-simple.info/forums/forumdisplay.php?fid=14)
+--- Thread: [SOLVED] Root .htaccess not created when installing (on some servers) (/showthread.php?tid=2604)



[SOLVED] Root .htaccess not created when installing (on some servers) - Carlos - 2012-01-16

EDIT: This has been fixed in r640

------

I have tried doing a fresh install of the latest 3.1 beta version (r625) at my webhost and I have a problem: the root .htaccess is not created.
I also tried with r568 and same result. However I don't have this problem with a fresh GS 3.0 install.

It seems it's because of a new check in admin/setup.php (around line 114):
Code:
# create root .htaccess file
        if ( function_exists('apache_get_modules') ) {
            if(in_arrayi('mod_rewrite',apache_get_modules())) {
                ...
            }
        }

(that was introduced by r553, and patched in r554)

My webhost does not have function apache_get_modules(), so next lines inside the if's are not executed.
However my webhost supports mod_rewrite ok.

I have googled about this and it seems that some servers (like mine, I presume) run PHP as a CGI and don't allow to get the list of apache modules. I don't know if this is something usual or not.

To prevent problems like this, but still support servers that don't have mod_rewrite (like issue 258), I suggest you change those two if's by this one (or something similar):

Code:
# create root .htaccess file
        if ( !function_exists('apache_get_modules') or in_arrayi('mod_rewrite',apache_get_modules()) ) {
            ...
        }

EDIT: I've corrected an error in the suggested patch.


[SOLVED] Root .htaccess not created when installing (on some servers) - Connie - 2012-01-16

I checked and noticed as well, that temp.htaccess is not renamed

PHP Version 5.2.6-1+lenny10

GS 3.0 works fine at that server


[SOLVED] Root .htaccess not created when installing (on some servers) - ccagle8 - 2012-01-16

Carlos, i see where the problem is happening, but I dont think that your code would work though. How is GS supposed to tell if mod_rewrite is there without the ability to check for apache_get_modules() ?


[SOLVED] Root .htaccess not created when installing (on some servers) - Carlos - 2012-01-17

Sorry Chris, there's an error. It should be without the second !:
Code:
# create root .htaccess file
        if ( !function_exists('apache_get_modules') or in_arrayi('mod_rewrite',apache_get_modules()) ) {
            ...
        }

This way, if GS cannot check for mod_rewrite support OR detects it IS supported, it creates (renames) the .htaccess file
If it can detect it is NOT supported (which is the case where there is a problem), it doesn't create it.

This behaviour wouldn't be very different from what GS 3.0 (and older) did. The .htaccess file seems not do any harm in most cases.