Civi 5.x not recognizing PHP 7.1 in Drush
That sounds like your command line version of php is different to the one being used by your webserver.

See eg https://drupal.stackexchange.com/questions/44967/the-php-version-is-not-correctly-detected