gpt4 book ai didi

php - composer、laravel 和 2 个版本的 PHP

转载 作者:行者123 更新时间:2023-12-04 19:34:38 25 4
gpt4 key购买 nike

我无法让 composer 和 laravel 在我的服务器上正常工作,

如果我跑,
php composer.phar update
我收到以下错误,

Problem 1
- laravel/framework v4.2.9 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.8 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.7 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.6 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.5 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.4 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.3 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.2 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.11 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.10 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.1 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.0 requires php >=5.4.0 -> no matching package found.
- laravel/framework v4.2.11 requires php >=5.4.0 -> no matching package found.
- Installation request for laravel/framework 4.2.* -> satisfiable by laravel/framework[v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].



现在我认为这是因为 php在我的 $PATH 上指向/usr/local/bin 并且 PHP 的版本是 5.3,但是我的服务器上也安装了 PHP 5.5.14,我可以像这样直接将 Composer 指向那个版本,
/usr/local/php-5.5.14-cgi/bin/php composer.phar update

然后我收到以下错误,

PHP Parse error: syntax error, unexpected '[' in /var/www/vhosts/popsapp.com/api.popsapp.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411 Script php artisan clear-compiled handling the post-update-cmd event returned with an error The disk hosting /var/www/vhosts/popsapp.com/.composer is full, this may be the cause of the following exception

                                                                                                [RuntimeException]                                                    

Error Output: PHP Parse error: syntax error, unexpected '[' in /var/www/vhosts/popsapp.com/a
pi.popsapp.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]



这让我相信 composer 或 larvel 仍在使用错误版本的 php,我如何确保完整安装使用 PHP 5.5.14?

最佳答案

composer update期间, Composer 正在调用 composer.json 中的脚本文件。对于 Laravel,这个文件看起来像:

"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},

所以你可以更新你的 composer.json使用正确版本的 PHP 或只是更新您的 $PATH 变量。我建议后者。

关于php - composer、laravel 和 2 个版本的 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27130036/

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