Laravel 4 syntax error out of the box

I just installed Laravel 4 (Illuminate), and when I opened the index.php file in the browser, I got this error:

Analysis error: syntax error, unexpected "income" (T_YIELD), pending identifier (T_STRING) in / www / Laravel 4 / vendor / illuminate / view / src / Illuminate / View / Environment.php on line 339

I set permissions for the meta folder and installed all the dependencies through Composer. I am running PHP version 5.5.0alpha2 on OSX 10.8.2.

+6
source share
1 answer

This is because yield become a language construct in PHP 5.5 (used by Generators ), but someone decided it was a good idea to use this short word to mean a function:

 public function yield($section) { return isset($this->sections[$section]) ? $this->sections[$section] : ''; } 

Switching to PHP 5.4 (after all, this is the current major version, 5.5 is not even in beta), and it should work fine.

+11
source

All Articles