Homestead安装完成,git克隆下来的项目不能运行composer install和php artisan命令

运行composer 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
    - This package requires php ^7.1.3 but your PHP version (7.0.1) does not satisfy that requirement.
  Problem 2
    - Installation request for chillerlan/php-qrcode 2.0.6 -> satisfiable by chillerlan/php-qrcode[2.0.6].
    - chillerlan/php-qrcode 2.0.6 requires php >=7.0.3 -> your PHP version (7.0.1) does not satisfy that requirement.
  Problem 3
    - Installation request for chillerlan/php-traits 1.1.13 -> satisfiable by chillerlan/php-traits[1.1.13].
    - chillerlan/php-traits 1.1.13 requires php >=7.0.3 -> your PHP version (7.0.1) does not satisfy that requirement.
  Problem 4
    - Installation request for laravel/framework v5.7.5 -> satisfiable by laravel/framework[v5.7.5].
    - laravel/framework v5.7.5 requires php ^7.1.3 -> your PHP version (7.0.1) does not satisfy that requirement.
  Problem 5
    - Installation request for laravel/horizon v1.4.0 -> satisfiable by laravel/horizon[v1.4.0].
    - laravel/horizon v1.4.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
  Problem 6
    - Installation request for symfony/cache v4.1.4 -> satisfiable by symfony/cache[v4.1.4].
    - symfony/cache v4.1.4 requires php ^7.1.3 -> your PHP version (7.0.1) does not satisfy that requirement.
  Problem 7
    - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.1) does not satisfy that requirement.
    - doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.1) does not satisfy that requirement.
    - Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - D:\PHPWAMP_IN2\phpwamp\server\php-7.0.1\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

运行php artisan make:controller TestController报错如下

PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in D
:\code\tiyu\vendor\symfony\console\Output\Output.php on line 40

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in D:\cod
e\tiyu\vendor\symfony\console\Output\Output.php on line 40

然后尝试删除那个问号,报错如下

PHP Fatal error:  Uncaught Error: Call to undefined function Symfony\Component\Console\Output\is_iterable() in D:\code\tiyu\vendor\symfony\console\Output\Output.php:140
Stack trace:
#0 D:\code\tiyu\vendor\symfony\console\Output\Output.php(132): Symfony\Component\Console\Output\Output->write('', true, 16)
#1 D:\code\tiyu\vendor\symfony\console\Application.php(741): Symfony\Component\Console\Output\Output->writeln('', 16)
#2 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(469): Symfony\Component\Console\Application->renderException(Object(Symfony\Component\Debug\Exception\Fatal
ThrowableError), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(101): Illuminate\Foundation\Exceptions\Handler->renderForConsole(Object(Symfony\Component\Console\O
utput\ConsoleOutput), Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#4 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation in D:\code\tiyu\vendor\symfony\console\Output\Output.php on line 140
PHP Fatal error:  Uncaught Error: Call to undefined function Symfony\Component\Console\Output\is_iterable() in D:\code\tiyu\vendor\symfony\console\Output\Output.php:140
Stack trace:
#0 D:\code\tiyu\vendor\symfony\console\Output\Output.php(132): Symfony\Component\Console\Output\Output->write('', true, 16)
#1 D:\code\tiyu\vendor\symfony\console\Application.php(741): Symfony\Component\Console\Output\Output->writeln('', 16)
#2 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(469): Symfony\Component\Console\Application->renderException(Object(Symfony\Component\Debug\Exception\Fatal
ErrorException), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(101): Illuminate\Foundation\Exceptions\Handler->renderForConsole(Object(Symfony\Component\Console\O
utput\ConsoleOutput), Object(Symfony\Component\Debug\Exception\FatalErrorException))
#4 D:\code\tiyu\vendor\laravel\framework\src\Illuminate\Foundation in D:\code\tiyu\vendor\symfony\console\Output\Output.php on line 140
长风秋雁
浏览 1142回答 3
3回答

GCT1015

它要求 php 7.1.3 至少,而你的环境只有 7.0.1它还要求 ext-pcntl 扩展而你没有开

绝地无双

1楼说的没错,你的php版本不对。不过我奇怪的是,你说你装好了homestead,homestead里面的php版本是7.1的,不应该出现你所说的问题的

慕桂英4014372

已经解决了,谢谢大家了
打开App,查看更多内容
随时随地看视频慕课网APP