ahl1
(Aleetribe)
November 20, 2014, 7:35am
1
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
ahl1
(Aleetribe)
November 20, 2014, 2:36pm
2
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
ahl1
(Aleetribe)
November 20, 2014, 2:37pm
3
line 75:
$callbacks = [‘setCookieValidationKey’, ‘setWritable’, ‘setExecutable’];
foreach ($callbacks as $callback) {
if (!empty($env[$callback])) {
$callback($root, $env[$callback]);
}
}
mdomba
(Maurizio Domba Cerin)
November 21, 2014, 11:39am
4
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…
ahl1
(Aleetribe)
November 22, 2014, 7:42am
5
Thank you - this did the trick.
Upgraded to PHP 5.5
php init is running!
keithscott
(Keith Scott)
November 26, 2014, 12:57pm
6
Thanks for sharing this to resolve this PHP error. I was also looking for the same.