Problem/Motivation
No warning is given if Drupal 8 is installed without the Apache rewrite module enabled. This results in a seemingly broken installation for users without this module enabled.
Proposed resolution
Use the .htaccess file to rewrite to a new URL with an appended parameter. Installation process will then check for this parameter. If it is present, rewrite module is installed and working properly. If it is not present, then a warning is shown to the user that the rewrite module is not installed and they are given a link to more information on clean URLs.
Remaining tasks
Reviews needed to accept a final form of the patch
User interface changes
New warning shown during install process if rewrite module is not installed.
API changes
None.
Original report by aspilicious
When apache rewrite is disabled you still can install drupal. When installed several key features for a cms like adding content will just fail ;).
Someone at the office had this issue when he wanted to try drupal8. We accidently found the cause of his broken D8 by going through every setting in his config files.
Is it possible to throw a warning when this isn't enabled. And if we add a check can we make sure it works for both apache en other systems like nginx for example (if that is needed for those systems).
Comments
Comment #1
joris_lucius@aspilicious I was checking this issue and agree it is not nice that you get a broken D8 after the installation.
However it is still possible to use this installation, see http://drupal.org/node/1659580
Using www.example.com/index.php/node/add it still works.
Is it an idea to check for the apache module and give a warning with an explanation?
If the warning is ignored use the dirty ~index.php so the default installation does not "crash"?
Any other thoughts like switching back (manual or automatic) once the rewrite is enabled is welcome.
Comment #2
chx CreditAttribution: chx commentedjust add back the clean url checker into system_requirements -- request a pseudo css/js which is in fact a menu callback doing the clean url check -- and thus issue a warning.
Comment #3
joris_luciusAssigning to myself, planning to have the first patch ready this week.
Comment #4
joris_luciusThere seems to problem by using the system_requirements.
Like described on http://api.drupal.org/api/drupal/core!modules!system!system.api.php/func... there are 4 different states, since this is a warning REQUIREMENT_WARNING(The requirement failed with a warning) seems to be the most logical. However the code in install.inc where the actual constant is defined says "Requirement severity -- Warning condition; proceed but flag warning."
If I set the severity to "Warning" it just throws an error during the installation and its not possible to continue, here these 2 texts seems to be in conflict.
When the REQUIREMENT_INFO (For info only) is used for the severity it is ignored if there are no other errors/warnings to be found. This renders this option useless in this situation.
An option is to convert all REQUIREMENT_INFO to drupal_set_message to display the message and not break the installation.
Code used in system_requirements():
And at the bottom
Is there any best practice to set warnings during the installation process if the requirements are not able to show warnings without stopping the install.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedI guess this is the same problem as #932636: Drupal *always* installs with clean URLs: because we have a
ErrorDocument
in.htaccess
, even if mod_rewrite is not working, all GET requests are kind of correctly served by Drupal, but *not* any other methods, so all forms submissions will fail.Comment #6
joris_lucius@Damien Tournoud That seems not be true, I am still able to do form submissions with mod_rewrite disabled using index.php/~
Looking into D7 and D6 now to help find a good solution, because D8 is still working without it and the install should not be stopped.
Comment #7
joris_luciusIncluded is my first patch for Drupal.
It checks if the rewrite is functioning during the installation, if not it gives an error.
This issue is discussed on IRC, D8 is still functioning even if the rewriting fails https://drupal.org/node/1183208
chx said that fixing the $base_url in the settings.php is also an option to work it.
But settings this url to www.example.com/index.php will break the css/js and does not make www.example.com go to www.example.com/index.php. The user still enters a "broken" website.
I am not an expert on .htaccess and cannot think of any good fix for this.
Any review or support on this issue is welcome.
Comment #9
Nick_vhAre you sure this is the best way to expose a link in a $t value? I think you'd need to wrap it in an l function.
$t('text !link.', array('!link' => l($t('description'), 'www.test.com')));
minor but spacing issue
Aside of that, I don't know enough of what you are trying to do, but I hope it helps :)
Comment #10
chx CreditAttribution: chx commentedThis misses a check of $install_state['interactive'] -- the testing system uses install_drupal to create the 'child' Drupal being tested and this requirement error aborts that.
Comment #11
joris_luciusNew patch with $install_state, $t fix and test with $requirements['description']
Comment #12
joris_luciusNever mind this comment, setting the status in this one queued the last comment for testing.
Comment #13
Nick_vhyou still have the spacing issue ;-)
Comment #14
chx CreditAttribution: chx commented-- Note: the rewrite rule and basing the check on it is my idea so please don't blame poor @joris_lucius if you find it very hacky.
Comment #15
joris_luciusHopefully the final patch.
Fixed the whitespace and made the code shorter, also removed the description placeholder.
Comment #16
joris_luciusTest passed, still needs manual testing because it affects the UI installer.
chx, swentel and other IRC support thanks for the help on my first core patch!
Comment #17
joris_luciusPut the 2 globals on the same line, nothing else.
Comment #18
tstoecklerThe $t issue is not fixed correctly. Please replace:
with
(Also, though this is minor: Shouldn't it be "clean URLs" instead of "Clean URLs"?)
Comment #19
Damien Tournoud CreditAttribution: Damien Tournoud commentedI don't understand, is this just a workaround for #1546082: Follow-up to variable_get('clean_url') removal?
Using Drupal on server setups that do not support rewriting is still supported. The wording of the change request that removed the
clean_url
variable is very clear.Comment #20
chx CreditAttribution: chx commentedNope. Drupal does not work without clean URLs now. If it will we can demote this to a warning. I think a warning is useful.
Comment #21
aspilicious CreditAttribution: aspilicious commenteddrupal forms (node edit forms etc) don't work without clean url's, it maybe works but there is no way you can tell why your nodes don't get saved. You get a 404 on a post or something like that.
Nothing in the report overview told us what the problem was.
Comment #22
chx CreditAttribution: chx commentedTagging -- this needs a much better issue summary. And, again, it's possible this is a stopgap issue but even so it's worth doing IMNSHO.
Comment #23
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedRe #1:
> Using www.example.com/index.php/node/add it still works.
Is there any other way to know this. Because I encountered this bug, searched in Google, located this issue and your comment to know it works this way.
I too think this needs fix. I have re-rolled the patch #17, with proper use of link in $t().
> (Also, though this is minor: Shouldn't it be "clean URLs" instead of "Clean URLs"?)
This is already "Clean URLs"
Comment #24
RyanPrice CreditAttribution: RyanPrice commentedUpdated issue summary
Comment #25
katy5289 CreditAttribution: katy5289 commentedI tested the patch and the error message comes up saying
Error - Clean URLs
Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.
I will attach a screenshot later
needs further code review
Comment #26
katy5289 CreditAttribution: katy5289 commentedAdding screenshot. When mod_rewrite is turned off, this error message displays.
Error - Clean URLs
Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.
Comment #27
xjmUntagging per #25 and #26.
Comment #28
xjm#23: drupal-rewrite_failure-1878884-23.patch queued for re-testing.
Comment #29
amateescu CreditAttribution: amateescu commentedSince the 'rewrite' query string is only added in .htaccess, we also need to restrict the requirements check to Apache.
Otherwise, with the current patch, Drupal won't be installable on any other server than Apache with mod_rewrite enabled.
Comment #30
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng commentedHi all,
I started testing Drupal 8 installs and ran foul this briefly. The 23 patch didn't work as out of date, get_t() function no longer needed etc. etc. so here is a new one.
I degraded to warning because there is still a danger it will act as a blocker to somebody on a non-standard setup and warnings do let you continue if you click through.
I added a check for 'Apache' contained in the server software, again for non-standard setups not using .htaccess.
I went along with the general conclusions of this thread as I don't know all the related issues, there are probably better ways and other areas that can be fixed but I believe that this makes things better as a lot of default setups don't have rewrites enabled, in 7 and below it worked (then then you kicked yourself and enabled rewrites to get clean urls). In Drupal 8 it is potentially confusion.
I am going to look at editing the documentation linked to in the warning next as that doesn't clarify the position for Drupal 8.
Edit: forgot to mention anything needs changing and I will attempt to do that as promptly as possible.
Comment #31
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng commentedAny chance this will get looked or should I stop worrying about it, was going to look at updating documentation, need for other issues (the requirements processes on install isn't clear when you have just a warning for example). Chances are this will go stale again soon though.
Comment #32
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng commentedHave a better understanding of this now, still think it is important, wrote a little about it here:
http://running-on-drupal8.co.uk/blog/drupal8-install-clean-urls
going to leave it a week or so then raise a new issue with better patch, might get some attention.
Comment #33
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng commentedI assume this is dead and with so many comments and confusion is no longer much use so have closed and attempted to raise a clearer issue #2094985: Drupal 8 install does not warn if Clean Urls are not supported I picked the best status I could apply.
Comment #33.0
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng commentedUpdating issue summary
Comment #34
geerlingguy CreditAttribution: geerlingguy commentedIf work is moving over to #2094985: Drupal 8 install does not warn if Clean Urls are not supported, this should be duplicate, not wontfix.
Comment #35
YesCT CreditAttribution: YesCT commentedThis is getting fixed in #2382513: Regression fix: allow Drupal 8 to work without Apache mod_rewrite