As outlined in an earlier article composer php version, when installing the latest version of Drupal the Plesk version and the server version can be different. In plesk, the version of PHP is 7.3.18, whereas, on the Centos server a check through Terminal (php -v) shows PHP 7.1.33 (cli).
When attempting to install Drupal 9 through composer, the following errors will be shown:
Problem 1 - drupal/core-composer-scaffold 9.1.x-dev requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.x-dev requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-rc1 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-beta3 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-beta2 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-beta1 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-alpha2 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0-alpha1 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - drupal/core-composer-scaffold 9.0.0 requires php >=7.3.0 -> your PHP version (7.1.33) does not satisfy that requirement. - Installation request for drupal/core-composer-scaffold ^9 -> satisfiable by drupal/core-composer-scaffold[9.0.0, 9.0.0-alpha1, 9.0.0-alpha2, 9.0.0-beta1, 9.0.0-beta2, 9.0.0-beta3, 9.0.0-rc1, 9.0.x-dev, 9.1.x-dev].
As per the earlier article, you will need to run the following command in Terminal or your shell interface:
export PATH=/opt/plesk/php/7.3/bin:$PATH;
If required you might need to run a httpd restart
CentOS 6
service httpd restart
CentOS 7
sudo systemctl restart httpd.service
While you are toying with the idea of upgrading to Drupal 9... also check the following conditions to install / upgrade:
- PHP version should be at least 7.3.0
- When using Apache, minimum version is 2.4.7
- When using Drush, minimum version is 10
More handy commands with Systemctl
To start the Apache service:
sudo systemctl start httpd.service
Stop the Apache service with:
sudo systemctl stop httpd.service
Force Apache to refresh the configuration files:
sudo systemctl reload httpd.service
Set Apache to run when the system boots:
sudo systemctl enable httpd.service
Prevent Apache from loading when the system boots:
sudo systemctl disable httpd.service
Note: the reload command is faster and creates much less disruption than restart. However, this only performs a soft refresh of the configuration files. Some services and dependencies may not be included in the refresh. A good practice is to consider the benefits and liabilities of each process. If you have several clients depending on access to your server, it might be more beneficial to refresh first. If that fails or if the disruption is minimal then use restart.