我目前正试图让我的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和#34; PHP by OS Vendor"是7.0.27
。但是,我知道服务器上安装了PHP 7.1+(甚至7.2),因为Plesk允许我选择(对于域和vhost)这些版本。我现在的问题是:如何告诉作曲家使用服务器上安装的某个PHP版本,以及如何使用Plesk在Debian下工作?
编辑:我没有全局安装Composer。只需https://getcomposer.org/download/"命令行安装"。
答案 0 :(得分:3)
以下是:
找到Plesk使用的PHP路径。就我而言,这是/opt/plesk/php/
。在此文件夹中,根据安装的PHP版本存在文件夹:7.0
,7.1
,7.2
。因此php composer.phar install
变为/opt/plesk/php/7.2/bin/php composer.phar install
。 &安培;有用。 : - )
答案 1 :(得分:0)
您可以使用composer.json
中的platform
设置来模拟PHP版本:
"config": {
"platform": {
"php": "7.1"
}
},
即使您使用7.0进行实际安装,Composer也会假设在安装和更新期间PHP版本为7.1。
这只会影响Composer的安装和更新 - 如果要运行应用程序的控制台命令,则需要使用正确的二进制文件(对于Web服务器也是如此)。但是,设置此选项将使您的Composer安装和更新更具可预测性,因此无论如何都值得这样做。