Answer the question
In order to leave comments, you need to log in
What is the error when running migration in yii2?
I'm running a migration to yii2 via the console.
An error occurs:
PHP Parse error: syntax error, unexpected '[', expecting ')' in /public_html/device/vendor/yiisoft/yii2/Yii.php on line 25
There was a suspicion that the php version is < 5.4.
I look phpinfo()
shows PHP Version 5.6.18.
I run php -v
PHP 5.3.29 (cli) from the console (built: Aug 21 2014 13:46:08)
The first question is who to trust? I understand it's still version 5.6?
Then the second question is why such an error occurs during migration?
------------------------
Update
used: php yii migrate/mark m160005_174529_users
but it should have been:
/opt/php56/bin/php yii migrate/mark m160005_174529_users
Answer the question
In order to leave comments, you need to log in
Find out from those. support of your hosting how to run an older version, for example, I do it like this:
/opt/php5.6/bin/php ...
Apparently the error is due to the fact that the language does not understand the short declaration of arrays. And this was just before version 5.4.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question