3

我目前正试图让我的 Laravel 应用程序在 Plesk Onyx 后面运行。现在尝试运行时composer install,我收到以下错误消息:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
    - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
  Problem 2
    - Installation request for symfony/css-selector v4.0.6 -> satisfiable by symfony/css-selector[v4.0.6].
    - symfony/css-selector v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
  Problem 3
    - Installation request for symfony/event-dispatcher v4.0.6 -> satisfiable by symfony/event-dispatcher[v4.0.6].
    - symfony/event-dispatcher v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
  Problem 4
    - Installation request for symfony/translation v4.0.6 -> satisfiable by symfony/translation[v4.0.6].
    - symfony/translation v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
  Problem 5
    - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
  Problem 6
    - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
    - laravel/framework v5.5.39 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
    - Installation request for laravel/framework v5.5.39 -> satisfiable by laravel/framework[v5.5.39].

好的。我肯定理解错误。我运行 Debian 9 并且“操作系统供应商的 PHP”是7.0.27. 但是,我知道服务器上安装了 PHP 7.1+(甚至 7.2),因为 Plesk 会让我选择(对于域和虚拟主机)这些版本。我现在的问题是:我如何告诉作曲家使用安装在服务器上的某个 PHP 版本,以及如何在 Debian 和 Plesk 下工作?

编辑:我没有全局安装 Composer。只需https://getcomposer.org/download/ “命令行安装”。

4

2 回答 2

3

就是这样:

查找 Plesk 使用的 PHP 路径。就我而言,这是/opt/plesk/php/. 在此文件夹内,根据安装的 PHP 版本,有文件夹:7.07.17.2。就这样php composer.phar install变成了/opt/plesk/php/7.2/bin/php composer.phar install。& 有用。:-)

于 2018-05-01T13:36:21.563 回答
0

您可以使用platform设置composer.json来模拟 PHP 版本:

"config": {
    "platform": {
        "php": "7.1"
    }
},

Composer 将在安装和更新期间假定 PHP 版本为 7.1,即使您使用 7.0 进行实际安装也是如此。

这只会影响 Composer 的安装和更新 - 如果您想运行应用程序的控制台命令,您将需要使用正确的二进制文件(对于 Web 服务器也是如此)。然而,设置这将使您的 Composer 安装和更新更具可预测性,因此无论如何都值得这样做。

于 2018-05-01T19:58:46.283 回答