i am trying to install yii 2 and to run the basic or advanced application.
i have tried the steps given here Setting up preview of Yii2 to do this.
the steps i followed,
1 - Installed the composer
2 - Use composer to install the app alongwith dependencies(Yii): php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-basic my_yii2_trial
3 - Access app from http://localhost/my_yii2_trial/web
The problem is, i am getting this syntax error.
Parse error: syntax error, unexpected '[', expecting ')' in D:\xampp\htdocs\my_yii2_trial\vendor\yiisoft\yii2\yii\Yii.php on line 25
can any body help to resolver this issue pls
Yii2 has started using PHP 5.4's Short array syntax. Your error creeps up because of:
spl_autoload_register(['Yii', 'autoload'], true, true);
in Yii.php, which is the new short array syntax. As you have already figured out, you need to install PHP 5.4 now to run Yii2 apps.
The commit which made the changes to short array syntax.
The docs and composer details that have been changed.
The discussion where the decision to move to PHP 5.4 was made.
As Yii2 is still in heavy development, its requirements are also changing. So be sure to read the readme thoroughly before installing.
See also the Backward Incompatible changes list for PHP 5.4, to make changes to your existing code.
Install PHP 5.4 to resolve this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With