In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1427 [In-Portal CMS] Install / Upgrages bug report always 2012-11-05 10:28 2012-11-07 10:48
alex  
alex  
normal  
resolved 5.2.0  
fixed  
 
none 5.2.1-B1  
https://groups.google.com/d/topic/in-portal-bugs/Xw33wdGc3nI/discussion
Fixes mod-rewrite module detecting during installation/upgrade
1
0001427: Mod-rewrite detection doesn't work when PHP is installed as CGI
When PHP is installed as CGI and not as "mod_php" into Apache, then system requirements step tells, that mod rewrite is not available.
But in fact mod rewrite works absolutely normally.

I propose to improve detection as advised by http://christian.roy.name/blog/detecting-modrewrite-using-php article by setting custom environment variable in .htaccess file, like this:

<IfModule mod_rewrite.c>
    // Tell PHP that the mod_rewrite module is ENABLED.
    SetEnv HTTP_MOD_REWRITE On
</IfModule>

and checking it later inside PHP:

if ( function_exists('apache_get_modules') ) {
    $modules = apache_get_modules();
    $mod_rewrite = in_array('mod_rewrite', $modules);
} else {
    $mod_rewrite = getenv('HTTP_MOD_REWRITE')=='On' ? true : false;
}


I also recommend wrapping whole rewrite-related code inside that IfModule statement since if mod-rewrite is really unavailable, then any directive from it (e.g. RewriteEngine) could cause "500 Internal Server Error" for whole website.
patch mod_rewrite_detection_1427.patch (5,045) 2012-11-07 09:19
http://tracker.in-portal.org/file_download.php?file_id=1859&type=bug
patch mod_rewrite_detection_1427_v2.patch (4,999) 2012-11-07 10:47
http://tracker.in-portal.org/file_download.php?file_id=1864&type=bug
Issue History
2012-11-07 10:48 alex Note Added: 0005285
2012-11-07 10:48 alex Status reviewed and tested => resolved
2012-11-07 10:48 alex Fixed in Version => 5.2.1-B1
2012-11-07 10:48 alex Resolution open => fixed
2012-11-07 10:48 alex Assigned To !COMMUNITY => alex
2012-11-07 10:48 alex Changeset attached 5.2.x r15620
2012-11-07 10:48 alex Note Added: 0005284
2012-11-07 10:48 alex Assigned To alex => !COMMUNITY
2012-11-07 10:48 alex Status needs testing => reviewed and tested
2012-11-07 10:48 alex Note Added: 0005283
2012-11-07 10:47 alex File Added: mod_rewrite_detection_1427_v2.patch
2012-11-07 09:21 erik Status needs work => needs testing
2012-11-07 09:21 erik Status needs testing => needs work
2012-11-07 09:21 erik Assigned To erik => alex
2012-11-07 09:20 erik Note Added: 0005274
2012-11-07 09:20 erik Status needs work => needs testing
2012-11-07 09:19 erik File Added: mod_rewrite_detection_1427.patch
2012-11-07 09:19 erik File Deleted: mod_rewrite_detection_1427.patch
2012-11-07 07:26 alex Note Added: 0005267
2012-11-07 07:26 alex Assigned To => erik
2012-11-07 07:26 alex Status needs testing => needs work
2012-11-07 06:41 erik Note Added: 0005266
2012-11-07 06:41 erik Developer => erik
2012-11-07 06:41 erik Status active => needs testing
2012-11-07 06:41 erik File Added: mod_rewrite_detection_1427.patch
2012-11-05 10:28 alex New Issue
2012-11-05 10:28 alex Reference => https://groups.google.com/d/topic/in-portal-bugs/Xw33wdGc3nI/discussion
2012-11-05 10:28 alex Change Log Message => Fixes mod-rewrite module detecting during installation/upgrade
2012-11-05 10:28 alex Estimate Points => 1

Notes
(0005266)
erik   
2012-11-07 06:41   
Done. Patch attached. Needs testing
(0005267)
alex   
2012-11-07 07:26   
1. Mod-rewrite Apache module related directives in .htaccess file were not wrapped with IF statement as advised.

2. Code isn't properly formatted (use automatic formatting of IDE to prevent this error in future).
(0005274)
erik   
2012-11-07 09:20   
1. Changed to wrap directives

2. Changed code formatting

Patch replaced with new version. Needs testing
(0005283)
alex   
2012-11-07 10:48   
Patch "mod_rewrite_detection_1427_v2.patch" has simplified code version and few empty lines removed.
(0005284)
alex   
2012-11-07 10:48   
OK
(0005285)
alex   
2012-11-07 10:48   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0001427: Mod-rewrite detection doesn't work when PHP is installed as CGI
Commit on behalf of Erik