简体   繁体   English

如何在部署时删除 PHP 版本错误

[英]how to remove PHP version error on deployment

I am using Xampp for local development, and I am working on the Laravel application.我正在使用 Xampp 进行本地开发,并且我正在开发 Laravel 应用程序。 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.我正在使用 Xampp 版本 7.2.28 并使用 Laravel Envoyer 进行部署。 How can I solve this?我该如何解决这个问题? Any help would be highly appreciable.任何帮助将是非常可观的。

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.你应该确保你的本地环境尽可能匹配实时环境,使用 Docker 非常方便。

Your possible solutions are:您可能的解决方案是:

  • Upgrade the PHP version on the live server升级直播服务器上的PHP版本
  • Downgrade the PHP version on your local to match production and adjust the dependencies accordingly降级您本地的 PHP 版本以匹配生产并相应地调整依赖项
  • 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降级您的依赖项,以便它们可以在 PHP 7.2.2 或更高版本上运行

The solution I would recommend is : "Downgrade your dependencies so that they can run on PHP 7.2.2 or later"我推荐的解决方案是:“降级您的依赖项,以便它们可以在 PHP 7.2.2 或更高版本上运行”

Note: I wouldn't actually recommend lowering your PHP version on the live system, but it is an option.注意:我实际上不建议在实时系统上降低您的 PHP 版本,但这是一个选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM