Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1180

Detect mod-rewrite also, when PHP is installed as CGI

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.1-B1
    • Component/s: Install / Upgrages
    • Labels:
      None

      Description

      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 [url]http://christian.roy.name/blog/detecting-modrewrite-using-php[/url] 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Erik Snarski [Intechnic]
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: