Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Seeing as D8 now requires php 5.3, Dries noted that we are only checking for php vers on install, and it does not check on upgrade.
This issue is to put a check in one of the instances of hook_update_N to require php 5.3.
Comment | File | Size | Author |
---|---|---|---|
#15 | 1414394-15.patch | 1.29 KB | xjm |
#12 | install.png | 10.78 KB | xjm |
#12 | update.png | 17.92 KB | xjm |
#10 | update.php-web_interface_PHP_version_check.png | 69.49 KB | Cameron Tod |
#7 | update_php_error.patch | 819 bytes | marcingy |
Comments
Comment #1
Cameron Tod CreditAttribution: Cameron Tod commentedIs this check intended to be included as a hook_update_N implementation in an install profile, or would it be better as a fatal error in update.php?
Comment #2
steve.colson CreditAttribution: steve.colson commentedI would think it should be a fatal error. How or where it is thrown I suppose is certainly up for discussion.
Comment #3
catchWe have a nice requirement check screen the first page of install.php (if there are environment errors), it'd be good to have the same on update.php. I thought we did at one point but perhaps not.
Comment #4
kotnik CreditAttribution: kotnik commentedActually, install.php exits immediately if PHP requirement isn't met. Should it be implemented in update.php in the same manner?
Comment #5
marcingy CreditAttribution: marcingy commentedBasically a straight lift from install.php.
Comment #7
marcingy CreditAttribution: marcingy commentedMeh
Comment #8
xjmThis seems like the right approach to me.
Comment #9
Dries CreditAttribution: Dries commentedIt looks like system.install does a check as part of system_requirements().
Do we not run hook_requirements as part of the site installation or site upgrade process?
Comment #10
Cameron Tod CreditAttribution: Cameron Tod commentedHook requirements is definitely run as part of the site install and update procedure, so I guess this bug is moot.
A quick test:
Comment #11
xjmRe: #10, I thought the issue was not that a message was not shown, but that errors appeared before the check?
Maybe someone should actually test it on 5.2. :)
Comment #12
xjmOkay, I just tested on 5.2, and yes, this issue is necessary. Here's why:
Comment #13
Cameron Tod CreditAttribution: Cameron Tod commentedQuite right, confirmed here too under PHP 5.2.17.
Parse error: syntax error, unexpected T_CONST in /Users/cam8001/Sites/drupal-8-trunk/core/update.php on line 31
However, the patch doesn't appear to work. I assume the whole file is parsed before any code is run, which means that PHP < 5.3 will raise a fatal error as soon as it finds any unsupported syntax.
Comment #14
xjmMmm, but the patch does not actually resolve the issue. It still contains a
const
keyword, so it fails as the file is parsed.We need to use
define
here as well:Comment #15
xjmAttached uses the same strategy as in
install.php
. This resolves the issue for me locally under 5.2.Comment #16
Cameron Tod CreditAttribution: Cameron Tod commentedPatch works well for me here too, tested with PHP 5.2.17.
Comment #17
catchThis looks good to me. The system_requirements() check works if we were to raise the minimum requirement to 5.3.4 or similar, we could leave this workaround as is at 5.3.2 in that case.
If we wanted to we could make the update.php/install.php check for 5.3.0 so there's a pretty error message between the syntax error and things working, but I don't think anyone runs > 5.3.0 and < 5.3.2 anyway so that's probably moot at the moment.
Comment #18
kotnik CreditAttribution: kotnik commentedTested patch from #15. All OK.
Comment #19
xjmYeah, I think it's good to give folks with PHP 5.3.0 the workaround message as well.
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedthis looks good to go for me.
Comment #21
catchThanks! Committed/pushed to 8.x.
Comment #23
MD3 CreditAttribution: MD3 commentedI ran into this issue when I went to: mydomain.com/drupal/
The error message when you go directly to your new Drupal install is (from the latest dev):
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/martindavisiii/d8.md3productions.com/drupal/core/includes/bootstrap.inc on line 3
However, the nicely formatted error message below does show up if you go to: mydomain.com/drupal/core/install.php
Your PHP installation is too old. Drupal requires at least PHP 5.3.3. See the system requirements page for more information.
For more information and discussion on this issue, please see:
#1463564: Drupal 8 does not work with PHP 5.3.2 (the version shipped with Ubuntu 10.04 LTS)