-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
(dev/drupal#79) Fail more gracefully when attempting to install on PHP 5.x #15089
Conversation
…P 5.x Before ------ If an admin stracts the code and navigates to `/sites/all/modules/civicrm/install/index.php`, it displays a syntax error. After ----- If an admin stracts the code and navigates to `/sites/all/modules/civicrm/install/index.php`, it displays the message: > __PHP Version Requirement__ > CiviCRM requires PHP 7.0+. The web server is running PHP 5.6.38. Comments -------- This is similar to civicrm/civicrm-drupal#583 The canonical representation of the minimum PHP version is in `$civicrm_root/CRM/Upgrade/Form.php`. However, setting up the classloader triggers a syntax error, so we need to read this without having access to the classloader. The approach herein has a few effects: * The minimum PHP can be read from a JSON file. * That JSON file is also used by `composer`, so you'll also get better errors when downloading that way. * At some unknown point, the minimum will probably bump up again (7.1 or 7.2 or whatever). When that happens, the unit-test will ensure we keep `CRM/Upgrade/Form.php` and `composer.json` in sync. Note: I was little concerned that the `composer.json` file might not be available when normal installers run, so I checked the published tarballs for D7, BD, WP, and J - in all cases, the `composer.json` looks to be included at the expected location.
(Standard links)
|
As noted in civicrm/civicrm-drupal#583 I had tested this along with that. Note that if you try to run composer install (with php 7) it says Separate note that isn't really relevant in 2019: While looking into some local issues during testing it came up that this adds a use of json_decode before it checks that json support is available in php (https://github.com/civicrm/civicrm-core/blob/5.16.2/install/index.php#L749). Unlikely to be a problem. |
@demeritcowboy Thanks. Yeah, normally when changing the For -if (file_exists($composerJsonPath)) {
+if (file_exists($composerJsonPath) && function_exists('json_decode')) { but then considered the user's journey a bit more. If you're on some old version of PHP where it was common to be missing
|
Makes sense. I suppose the alternate error if function_exists('json_decode') fails could just be "CiviCRM requires PHP 7.0+. The web server is running PHP 5.1.0.", which is technically not the failure reason but gets them there faster. Anyway it seems to be enough as-is and thanks you've done a lot on this issue already. |
@seamuslee001 & I discussed & feel this is better in than out & it would be fine to push out 5.16 with this in it |
See also: https://lab.civicrm.org/dev/drupal/issues/79
Before
If an admin stracts the code and navigates to
/sites/all/modules/civicrm/install/index.php
, it displays a syntax error.After
If an admin stracts the code and navigates to
/sites/all/modules/civicrm/install/index.php
, it displays the message:Comments
This is similar to civicrm/civicrm-drupal#583
The canonical representation of the minimum PHP version is in
$civicrm_root/CRM/Upgrade/Form.php
. However, setting up the classloader triggers a syntax error, so we need to read this without having access to the classloader.The approach herein has a few effects:
composer
, so you'll also get better errors when downloading that way.CRM/Upgrade/Form.php
andcomposer.json
in sync.Note: I was little concerned that the
composer.json
file might not be available when normal installers run, so I checked the published tarballs for D7, BD, WP, and J - in all cases, thecomposer.json
looks to be included at the expected location.