0

When I try to run composer update it gives me that error message

This package requires php ^7.1.3 but your PHP version (7.0.33) does not satisfy that requirement.

and when I try composer dump-autoload on my laravel app it gives me

Parse error: syntax error, unexpected '=' in /home2/elmohare/public_html/okttob/vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 380

NOTE :: the app works great on my localhost but I have this problem only on my server

when I try php -v it gives me

PHP 7.3.5 (cli) (built: May  7 2019 16:13:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group

and I searched about this problem, all people say that apache version is different of php cli version, but the real problem is I've made phpinfo() file on my server to see the apache php verison and it gave me also

PHP Version 7.3.5

So it seems right, anyone knows the solution?

Heavy
  • 1,861
  • 14
  • 25
Ahmed Osama
  • 672
  • 1
  • 8
  • 15
  • 1
    If you have multiple PHP versions installed, it could be that Composer is looking at the wrong one to check the version. e.g. - maybe it's searching for the first binary which matches the pattern `/usr/bin/php*` but your PATH variable is actually running `/usr/local/bin/php`. Try running `locate bin/php` and see what comes up, then for each file returned that looks like a PHP binary, try running `-v` on it. – stevendesu May 10 '19 at 19:16
  • `/usr/bin/env php -v` will show you the version of PHP that composer is using. – miken32 May 10 '19 at 20:41
  • Possible duplicate of [How to assign / set specific php version to composer?](https://stackoverflow.com/questions/41908492/how-to-assign-set-specific-php-version-to-composer) – Prafulla Kumar Sahu May 11 '19 at 09:09
  • Does your `composer.json` file possibly include (`platform`)[https://getcomposer.org/doc/06-config.md#platform] config, which would override the PHP version installed on the server with the one specified there? – Edi Modrić May 11 '19 at 09:19
  • my composer.json doesnot but my composer.lock has the platform to 7.1.3 witch is lower than 7.3.5 on my server >> should I edit it to be 7.3.5 or delete it ?? ** please note that my local host php version is 7.1.3 and my server is 7.5.3 so if I edit the platform it will not work on my localhost I think ** – Ahmed Osama May 12 '19 at 11:50
  • You could just try deleting the lock file and running composer install. (Backup first of course.) – miken32 May 12 '19 at 18:00

0 Answers0