This question already has an answer here:
I am having trouble with my elgg installation for my website. Every time I load the "install.php" in the root directory, I keep getting this error:
Parse error: syntax error, unexpected '[' in (Root)/engine/classes/Elgg/Di/ServiceProvider.php on line 194
Here is line 194 in that file:
$params = $c->config->get('cookies')['session'];
I have PHP version 5.3.13. Can anyone help?
</div>
Arrays can't be referenced directly from a return object in PHP below 5.4. [Documentation]
You can't do this:
$params = $c->config->get('cookies')['session'];
But you CAN do this:
$cookies = $c->config->get('cookies');
$params = $cookies['session'];
Or you can just upgrade your PHP installation.
You can't do this because you don't have PHP version 5.4 or higher!
So change this:
$params = $c->config->get('cookies')['session'];
to this:
$params = $c->config->get('cookies');
$params = $params['session'];
For more information about array dereferencing see the manual: http://php.net/manual/en/language.types.array.php
And a quote from there:
As of PHP 5.4 it is possible to array dereference the result of a function or method call directly. Before it was only possible using a temporary variable.