I am using Magento 2.2.6, i am trying to run composer. but its shows php version error.
where as my php version is set correctly. please check the attached screenshot.
please help me to fix this.
You're trying to run composer with PHP5, I assume you got both PHP7 and PHP5 installed and it's defaulting to PHP5.
Since Magento 2 Minimum PHP Version is 7 See Minimum specs
You can find out what versions of PHP you got installed by running
Redhat Distros: rpm -qa | grep php
Debian Distros: apt list --installed | grep
Then when you try to run composer you can specify what PHP install you want it to use like so
php7.1 composer update
If that still does not work, are you sure you got the CLI interpreter for PHP 7 installed as well
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update && apt-get install php7.1-cli
Try executing command with ignore platform appended
$ composer install --ignore-platform-reqs