Skip to main content

Updating Drupal from 8.7.10 to 8.8.x or 8.9.x has seen a significant change as it has now moved into 9.x.  It has integrated more with composer, and you can be caught by fatal errors occurring during the update process.  One of these errors for me was the php version.  

  • Site version as set through Plesk is PHP 7.3.12
  • Using ssh via Terminal the command
    • php -v
    • PHP 7.1.33 (cli) (built: Oct 25 2019 11:33:58) ( NTS )
  • Whereas, composer update was showing
    • Problem 1 - This package requires php >=7.0.8 but your PHP version (5.6.29) does not satisfy that requirement.
    • Problem 2 - typo3/phar-stream-wrapper v3.1.3 requires php ^7.0 -> your PHP version (5.6.29)

And on the list of errors went.

The reason composer was showing 5.6.29 is when I installed composer I had set the export path to 5.6.  Yep my bad, it should have been updated long ago.  The original export path that had been set was

export PATH=/opt/plesk/php/5.6/bin:$PATH;

Updating this call is what was required

export PATH=/opt/plesk/php/7.1/bin:$PATH;

The command composer update is now successful without PHP 5.6 errors

If required you might need to run a httpd restart

CentOS 6

service httpd restart

CentOS 7

sudo systemctl restart httpd.service

 

Composer version - locally I was running 1.4.1 and whereas remotely on the server 1.10.19.  If you want or need to update composer in the respective environment (local or remote) run 

composer self-update

For some reason, if you find this updated version creating issues for you, then you can go back to the previous version you had running with this command

composer self-update --rollback

I updated to the current version of composer being 2.0.8.

 

PHP 7.1 EOL an update... to 7.3 or 7.4?

When this article was first written, PHP 7.1 was okay to be using.  However, time for an update as PHP 7.1 has reached its end of life (EOL).  Actually it did so quite some time ago now... 1st December 2019.

Towards the start of this article, the Plesk version had been set to PHP 7.3.12.  Subsequently, the needs to reflect this state.  You might have guessed the path now becomes:

export PATH=/opt/plesk/php/7.3/bin:$PATH;

However, is this enough?

At the time of writing this update (March 2021), PHP 7.3 EOL is 6th December 2021.  Whereas, PHP 7.4 has an EOL of 28th November 2022.  Therefore, it would be better if you update to PHP 7.4.

export PATH=/opt/plesk/php/7.4/bin:$PATH;

Remember to update Plesk as well to be running off PHP 7.4.

As always test and check

php -v

​​​​​​​Output from the version call:

PHP 7.4.16 (cli) (built: Mar  5 2021 15:18:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

Keep up to date with the PHP versions that are EOL and currently support on the PHP supported versions page.