我在Ubuntu 16.04.6 LTS Plesk 17.8.11上安装了几个PHP版本(7.0、7.1和7.2)即使我在.bashrc文件中设置以下行:
alias php='/opt/plesk/php/7.2/bin/php'
我检查(使用PHP -V),当前的PHP版本实际上是7.2
但是,当我运行行时:
作曲家create-project symfony/weblot-skeleton my-project
我仍然有Symfony 3.4而不是4.x
:(
这是" CREATS-Project Symfony/werfeS-Skeleton myProject"命令行:
之后的Composer.json文件:{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.0.8",
"ext-ctype": "*",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "3.4.*",
"symfony/console": "3.4.*",
"symfony/dotenv": "3.4.*",
"symfony/expression-language": "3.4.*",
"symfony/flex": "^1.1",
"symfony/form": "3.4.*",
"symfony/framework-bundle": "3.4.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "3.4.*",
"symfony/security-bundle": "3.4.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "3.4.*",
"symfony/twig-bundle": "3.4.*",
"symfony/validator": "3.4.*",
"symfony/web-link": "3.4.*",
"symfony/yaml": "3.4.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "3.4.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "3.4.*"
}
}
}
这是解决方案对我有用的:由于作曲家将始终在服务器上使用默认的PHP版本,因此创建一个别名:Alias Composer ='/opt/opt/plesk/plesk/php/7.2/7.2/bin/php/usr/lib/plesek-9.0/composer.phar',然后作曲家将安装Symfony 4.x!