Search code examples
mysqllaravellaravel-4uploading

After uploading Laravel to server I get an error message on my routes page


I'm almost done with a Laravel project I'm working on and am wanting to try it out on an actual server.

However after I loaded the entire project (slower than using composer but I was hoping to keep this as simple as possible the first time I tried this) I can't even log in as I'm getting a "syntax error, unexpected '['" error message with the debug window pointing to this code:

Route::get('login', [
    'as'    => 'login',
    'uses'  => 'SessionsController@create'
    ]);

I tried changing it to

Route::get('login', array(
    'as'    => 'login',
    'uses'  => 'SessionsController@create'
    ));

but after I changed it and uploaded the file again it still looked like the original code. To make things more confusing the code should work either way, unless I am missing something.

If anyone can point out 1.)the reason for the error message - the project runs fine on my local server and 2.)why the file does not seem to be updating when I send in a new version it would be greatly appreciated! Thanks!


Solution

  • Your actual server is running PHP 5.3

    Your local server is running PHP >=5.4

    The short array syntax [] was added in PHP 5.4. See change log here.