gpt4 book ai didi

php - Symfony 5.4.9 Composer 检测到您的平台存在问题 :

转载 作者:行者123 更新时间:2023-12-02 01:34:59 24 4
gpt4 key购买 nike

我对 Symfony 完全陌生。在我的本地 ddev 机器上安装 Symfony 后,我收到此错误

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.29. in /var/www/html/symfony/vendor/composer/platform_check.php on line 24

我也尝试composer install --ignore-platform-reqs,当我运行它时,我收到此错误消息

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /var/www/html/symfony/vendor/psr/log/src/LoggerInterface.php on line 30

我的php版本是

❯ php -v
PHP 8.1.6 (cli) (built: May 12 2022 23:44:22) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
with Zend OPcache v8.1.6, Copyright (c), by Zend Technologies

Compose.json

    "type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/console": "*",
"symfony/dotenv": "*",
"symfony/flex": "^1.17|^2",
"symfony/framework-bundle": "*",
"symfony/runtime": "*",
"symfony/yaml": "*"
},
"require-dev": {
},
"config": {

感谢帮助

更新

如果您使用 docker/ddev,请确保在 config.yml 中设置 php 版本

确保 php 版本符合 symfony 要求

name: ddev-gitpod
type: drupal9
docroot: web
php_version: "8.1"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.3"
nfs_mount_enabled: false
mutagen_enabled: false
use_dns_when_possible: true
composer_version: ""
web_environment: []
nodejs_version: "16"

最佳答案

运行此命令:

symfony local:php:list

您将得到一些输出,列出您计算机上安装的 php 的各个版本,并且 symfony 二进制文件使用的版本将突出显示。还会有关于如何控制二进制文件使用的版本的说明:

To control the version used in a directory, create a .php-version file that contains the version number (e.g. 7.2 or 7.2.15).

关于php - Symfony 5.4.9 Composer 检测到您的平台存在问题 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72572584/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com