Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
作曲家及;Plesk,遇到PHP版本困难_Php_Laravel_Composer Php_Plesk_Debian Stretch - Fatal编程技术网

作曲家及;Plesk,遇到PHP版本困难

作曲家及;Plesk,遇到PHP版本困难,php,laravel,composer-php,plesk,debian-stretch,Php,Laravel,Composer Php,Plesk,Debian Stretch,我目前正试图让我的Laravel应用程序运行在Plesk Onyx之后。现在,当尝试运行composer安装时,我收到以下错误消息: 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/inflecto

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

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 by OS Vendor”是
7.0.27
。然而,我知道服务器上安装了PHP7.1+(甚至7.2),因为Plesk让我选择(对于域和vHost)这些版本。我现在的问题是:如何告诉composer使用安装在服务器上的特定PHP版本,以及如何在Debian和Plesk下工作

编辑:我没有全局安装Composer。只需“命令行安装”。

以下是如何:

查找Plesk使用的PHP路径。在我的例子中,这是
/opt/plesk/php/
。在此文件夹中,有根据安装的PHP版本的文件夹:
7.0
7.1
7.2
。因此
php composer.phar安装
变成
/opt/plesk/php/7.2/bin/php composer.phar安装
它有效。:-)

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

"config": {
    "platform": {
        "php": "7.1"
    }
},
Composer将假定PHP版本在安装和更新期间为7.1,即使您使用7.0进行实际安装

这只会影响Composer的安装和更新-如果要运行应用程序的控制台命令,则需要使用正确的二进制文件(web服务器也是如此)。但是,设置此选项将使您的Composer安装和更新更加可预测,因此无论如何都值得这么做