Michael Emerson
Michael Emerson

Reputation: 1813

Unexpected '[', expecting ')' in Symfony console file

This is a strange one, I have never come across it before - but then I've not used Symfony 3.1, only 2.8.

When I run a console command such as clear:cache or a doctrine:schema:update, I get the following error on terminal:

PHP Parse error: syntax error, unexpected '[', expecting ')' in /var/www/vhosts/mycrmsitetest.co.uk/httpdocs/bin/console on line 20

The line its referring to in the console file is:

$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');

This is exactly the same as on my local drive, but it works there - it's only when it's on the server that this fails.

Does anyone know what this may be?

Upvotes: 1

Views: 663

Answers (1)

Dmitry Malyshenko
Dmitry Malyshenko

Reputation: 3051

You need PHP version greater then 5.4. Your script contains the new array syntax ('[]' instead of 'array()'): http://php.net/manual/en/migration54.new-features.php

Upvotes: 2

Related Questions