我在我的网站上安装了Laravel 5.0(通过FTP)。然后我尝试通过SSH连接,并使用Composer进行更新。然而,我得到了这个错误。(我的PHP是5.5版本,我检查了phpinfo函数)。
PHP Notice: Undefined index: argv in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 55
PHP Warning: array_shift() expects parameter 1 to be array, null given in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 59
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
PHP Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
[ErrorException]
Invalid argument supplied for foreach()
X-Powered-By: PHP/5.3.28
Content-type: text/html
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Notice: Undefined index: argv in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 55
Warning: array_shift() expects parameter 1 to be array, null given in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 59
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
Warning: Invalid argument supplied for foreach() in phar:///home/cluster-sites/58/kerimcaglar.com/laravel/composer.phar/vendor/symfony/console/Input/ArgvInput.php on line 285
我控制了cli-v,但找不到这个命令。
后来我尝试了以下内容:
$ php -d register_argc_argv=1 "./composer.phar" install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- league/flysystem 1.0.16 requires php >=5.4.0 -> your PHP version (5.3.28) or value of "config.platform.php" in composer.json does not satisfy that requirement.
- league/flysystem 1.0.16 requires php >=5.4.0 -> your PHP version (5.3.28) or value of "config.platform.php" in composer.json does not satisfy that requirement.
- Installation request for league/flysystem 1.0.16 -> satisfiable by league/flysystem[1.0.16].
我怀疑这是一个重要的错误:
警告:应该通过PHP的CLI版本调用Composer,而不是通过cgi-fcgi SAPI
尝试which php
查看PHP二进制文件的指向,然后尝试locate bin/php
查看系统的其他版本。
还要注意:
我的PHP版本是5.5;我检查了phpinfo函数
你不同意的地方:
X-Powered-Bor:PHP/5.3.28
使用完全限定的路径,尝试使用locate
发现的PHP二进制文件的其他副本。例如:
/usr/bin/php55-cli composer.php update
如果这个主机有一个5.5 CGI二进制文件和一个5.3控制台二进制文件,他们可能不知道自己在做什么——5.3现在应该不再受支持。如果您自己没有成功修复它,请创建一个支持票证,并请求php
从shell调用5.5控制台二进制文件。
更新:根据评论中的对话,上面似乎解决了一个问题,暴露了另一个问题。新的问题是Composer命令越来越远,它试图再次调用使用php
二进制文件的PHP助手。这导致了最初的问题(这是web服务器二进制文件,是5.3而不是5.5)
要解决此问题,我建议您(a)创建一个本地php
可执行文件以指向所需的版本,然后(b)重置系统路径。我会在你的项目目录中尝试以下内容:
ln -s /usr/bin/php55-cli ./php
PATH=. ./php composer.phar update
这将创建一个指向所需PHP版本的符号链接,然后将系统路径临时重置为当前目录。
如果这还不能完全解决问题,您可能需要将您的符号链接放在一个更永久的位置(例如~/bin/php
并修改您的shell启动文件。在惊呼它不起作用之前,请先考虑一下-学习如何独立完成这项工作的最佳方法是尝试!