-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional method to check for mod_rewrite #6911
Add additional method to check for mod_rewrite #6911
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this one A and one change before we merge
@@ -213,6 +213,12 @@ public static function hasModRewrite(): bool | |||
$check = in_array('mod_rewrite', apache_get_modules()); | |||
} | |||
$logger->debug("Apache mod_rewrite check status: $check"); | |||
if (empty($check)) { | |||
if (!empty(shell_exec('/usr/sbin/apachectl -M | grep rewrite'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we catch errors from shell_exec and ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will double check behavior, but I thought I read that any errors would naturally be ignored, so not sure what action could be taken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have verified that errors simply result in an empty output from shell_exec() -- so this should cause no problems if the path is wrong, it just won't be able to detect the module. I have verified that on Windows also -- though I think often in the Windows setup php would be a module within apache, and this bit of code would never be executed.
Description & Issue number it closes
This closes #6910 by adding an additional method to check if apache is able to process rewrite rules.
Screenshots (if appropriate)
N/A
How to test the changes?
This could be checked if a demo could be spun up on Softaculous from this change... and then checking the Admin/Debug page to verify that it reports mod_rewrite is detected.
Alternatively, if you are running a setup where php is not loaded as a module, but is enabled via CGI (which prevents apache_get_modules() from working via PHP) -- then you can verify the rewrite module is properly detected in this case similarly with the Admin/Debug page, or in the initial ChurchCRM setup, if you have a blank database.
Type of change
How Has This Been Tested?
This has been tested on a RockyLinux v8 install, using php via the php-fpm service.
Checklist: