1

This question already has an answer here:

Got Drush 8 installed alright, but when I try to drush up my Drupal 8.0.0 site I get a Parse error: syntax error, unexpected '[' in /is/htdocs/.../.composer/vendor/drush/drush/includes/output.inc on line 188

Line 188 looks alright to me. What may be wrong?

marked as duplicate by Clive Dec 28 '15 at 23:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You are running with php 5.3 or earlier. Drush 8 needs php 5.4 or later. Unfortunately, php 5.3 does not understand array syntax, so the failure is raised before any Drush code runs. For other sorts of errors, Drush will tell you that your php is too old.

I am guessing you are using php 5.5 for Drupal 8; check which php and php --version to see if your php-cli is the same version as your Web server php.

UPDATE:

Set the environment variable DRUSH_PHP to the full path of the PHP executable that you would like to run. Note that this will only work if you are using a Composer or git install of Drush; if you are using drush.phar, this feature is not available. For the .phar, you would need to use a shell script named "php" that calls php5.6. Then, set your PATH such that your php script comes before the one offered by default on the platform.

  • Well, thanks! You are so right. The virtual host I am using offers php 5.6 but says I have to call it explicitly like: php5.6 ... Do you know of a way to tell the shell to always use it, i. e. a setting in .profile? – Frank Spade Dec 29 '15 at 12:25
  • Updated answer to address question in the comment. – greg_1_anderson Dec 29 '15 at 17:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.