PHP Parse error: parse error in <path>/init on line 75

Hi,

I’m hoping someone can help me - new to Yii, but have experience on other platforms and languages.

I’m getting an error running “php init” with the “advanced” code for Yii2.

I was able to get the "basic" example running for Yii just fine.

Using Mac OS X

I just used "tar xvf yii-advanced-app-2.0.0.tgz"

cd advanced

php init

PHP Parse error: parse error in /Applications/XAMPP/xamppfiles/htdocs/advanced/init on line 75

Is this an environment issue?

or user error?

Hoping someone has some tips or tricks.

Thanks,

andy

is it my PHP Version:

$ php -v

PHP 5.3.28 (cli) (built: Jan 23 2014 18:02:48)

Copyright © 1997-2013 The PHP Group

Zend Engine v2.3.0, Copyright © 1998-2013 Zend Technologies

line 75:

$callbacks = [‘setCookieValidationKey’, ‘setWritable’, ‘setExecutable’];

foreach ($callbacks as $callback) {

if (&#33;empty(&#036;env[&#036;callback])) {


    &#036;callback(&#036;root, &#036;env[&#036;callback]);


}

}

Did you check the Yii2 requirements… you need PHP 5.4…

From PHP 5.4 there is a new array notation as you can see it on the line 75, so that’s why you get the error… but then I don’t understand how did you get the basic example to work… could be there where no array used…

Thank you - this did the trick.

Upgraded to PHP 5.5

php init is running!

Thanks for sharing this to resolve this PHP error. I was also looking for the same.