1 (edited by Carlos 2012-02-12 15:14:29)

Topic: [SOLVED] Root .htaccess not created when installing (on some servers)

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):

        # 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):

        # 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.

Re: [SOLVED] Root .htaccess not created when installing (on some servers)

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

|--
Die deutsche GetSimple-Webseite: http://www.Get-Simple.de = the german Get-Simple-Website!
Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forum/forum/16/german-deutsch/

Re: [SOLVED] Root .htaccess not created when installing (on some servers)

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

- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!

Re: [SOLVED] Root .htaccess not created when installing (on some servers)

Sorry Chris, there's an error. It should be without the second !:

        # 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.