By default composer uses main php installation in /usr/bin/php, but in most cases you have an old php version installed there, if you use a RedHat distribution:
[nick@ ~]$ php -v | head -n 1
PHP 5.4.16 (cli)
And composer commands will most likely fail, because most up to date packages need php 7.0 or newer:
[nick@ ~]$ composer update
- Installation request for peppeocchi/php-cron-scheduler 3.* -> satisfiable by
- peppeocchi/php-cron-scheduler v3.0 requires php ^7.1 -> your PHP version (5.4.16)
does not satisfy that requirement.
In case you do not want to use 3rd party repositories or have any other reasons not to update your main php installation, you can use composer with an additional php installation in a custom folder . For example, you can use Plesk control panel to easily install and manage them.
To point composer to a custom php installation, you se the following command:
Check your PHP version:
[nick@ ~]$ php -v |head -n 1
PHP 7.2.33 (cli) (built: Aug 13 2020 18:42:40) ( NTS )
And run composer again: