R
R
Ruslan Saifullin2016-05-17 18:03:18
Yii
Ruslan Saifullin, 2016-05-17 18:03:18

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

because php version in console was 5.3 by default

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Donkovtsev, 2016-05-18
@Shapito27

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 ...

D
Dmitry Kim, 2016-05-17
@kimono

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.

A
Andrey, 2016-05-17
@VladimirAndreev

well, php5-cli and php5-fpm may very well be different versions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question