From the beginning I tried on Denver through the composer, it failed to start init produces this error enter image description here

I understand that the PHP version does not match the requirement, since I already had other projects on Denver, I did not update it and installed winginx there in the package is PHP 5.3. * And PHP 5.4. *. Created a project yii2.loc, chose the version of PHP 5.4, then copied Yii2 from Denver to winginx and try to run, again the error enter image description here As I understand it, this comes out because winginx defaults to PHP 5.3 because when you open localhost / phpinfo.php, PHP 5.3 shows it. Tried to make PHP 5.4 by default did not work. How to solve a problem?

  • 3
    Use some openserver instead of Denver. - etki
  • @Etki, yes, openServer installed, earned, but that's why the project is created without the vendor folder, I can not understand the reason - bemulima
  • one
    composer install same - etki

2 answers 2

Yii2 requires PHP version 5.4 or higher.

New features in PHP 5.4 :

Added short array declaration syntax. For example, $ a = [1, 2, 3, 4]; or $ a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4] ;.

Since your version is lower, it does not support declaring an array with a syntax of the form $array = [] , which leads to this error.

You can check the current version of php by writing the command php -v in the console

    in general, in yii2 there is a requirements.php script

    It is just needed for such cases. I advise you to run it after installing yii2