how to remove PHP version error on deployment

500 views Asked by At

I am using Xampp for local development, and I am working on the Laravel application. Everything works fine on the local server, but I am unable to deploy it. I am getting this error:

Problem 1
    - Installation request for symfony/css-selector v5.0.6 -> satisfiable by symfony/css-selector[v5.0.6].
    - symfony/css-selector v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
  Problem 2
    - Installation request for symfony/mime v5.0.6 -> satisfiable by symfony/mime[v5.0.6].
    - symfony/mime v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
  Problem 3
    - Installation request for symfony/service-contracts v2.0.1 -> satisfiable by symfony/service-contracts[v2.0.1].
    - symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
  Problem 4
    - Installation request for symfony/translation-contracts v2.0.1 -> satisfiable by symfony/translation-contracts[v2.0.1].
    - symfony/translation-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
  Problem 5
    - symfony/mime v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
    - symfony/http-foundation v4.4.6 requires symfony/mime ^4.3|^5.0 -> satisfiable by symfony/mime[v5.0.6].
    - Installation request for symfony/http-foundation v4.4.6 -> satisfiable by symfony/http-foundation[v4.4.6].

I am using Xampp version 7.2.28 and using Laravel Envoyer for deployment. How can I solve this? Any help would be highly appreciable.

1

There are 1 answers

3
Scriptable On

Thats becuase the version you are using locally is newer than the version of on the server. so your installing dependencies for the newer version and then trying to install on a lower version. you should make sure that your local environments match the live enviornment as much as possible, using Docker is quite handy for this.

Your possible solutions are:

  • Upgrade the PHP version on the live server
  • Downgrade the PHP version on your local to match production and adjust the dependencies accordingly
  • Set versions of your dependencies for the live system to compatible versions and re-install the dependencies
  • Downgrade your dependencies so that they can run on PHP 7.2.2 or later

The solution I would recommend is: "Downgrade your dependencies so that they can run on PHP 7.2.2 or later"

Note: I wouldn't actually recommend lowering your PHP version on the live system, but it is an option.