Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Root .htaccess not created when installing (on some servers)
#1
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.
Reply
#2
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
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#3
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!
Reply
#4
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.
Reply




Users browsing this thread: 1 Guest(s)