I'm running Drush on a host that has multiple versions of PHP installed. By default, php --version would give you 5.2.x, but php53 and php54 are also available. So in my .bash_profile I have alias php='php53' (php --version = 5.3.13), which makes Drush work for some commands.

However, I still get "Your command line PHP installation is too old. Drush requires at least PHP 5.3.2" messages for some very useful commands.

A couple of really annoying instances:

  • drush pm-update will report that it has backed up and then updated all modules and core successfully, then return the PHP version error and restore all backups. In verbose mode, the command that comes before the error is: php /home/[username]/drush/drush.php --backend=2 --verbose --root=/home/[username]/webapps/drup --uri=http://[domain name] pm-updatecode-postupdate 2>&1
  • drush archive-dump will immediately return the PHP version error

The other commands I have tried so far work fine. I'm not sure why this would be, if Drush is sometimes using the php53 binary, and other times not, or if it just has trouble detecting the version correctly, but some very important features are broken for me.

5 Answers 5


Drush doesn't use just php directly as a command, but need the full path. With the last version of Drush, you can add the following line in your .bash_profile to set which PHP you want to use.

export DRUSH_PHP=/Applications/MAMP/bin/php/php5.3.14/bin/php

Here is just an example of MAMP, but you can change it as well with your own path.

  • 1
    To refine the above explanation: when Drush calls back into itself, it execs 'php', and takes the first php in your PATH. Bash aliases are not visible to php exec, so alias php='php53' is not seen. The explanation above fixes the problem, as would export DRUSH_PHP=php53. Another solution would be to insure that php53 appears in your PATH before any other PHP when running Drush. Sep 27, 2012 at 15:24
  • if you are using oh_my_zsh be sure .zshrc
    – user24137
    Dec 2, 2013 at 21:46
  • This fixed it for me. Though I had to do source .bash_profile for immediate effect
    – Alma
    Mar 14, 2016 at 19:34
  • 1
    If you're using MAMP, configuration of the DRUSH_PHP variable is not enough. See docs.drush.org/en/7.x/configure
    – sea26.2
    Jun 19, 2018 at 19:38
  • 1
    DRUSH_PHP is only supported in Drush 8 and earlier. In Drush 9 and later, you are expected to manage your PATH such that the PHP that you would like to use appears first. Dec 16, 2019 at 23:50

Here's another solution:

  1. Create a symbolic link to the desired version of php (php5.4 in my case) ln -s /usr/local/bin/php54 ~/bin/php

  2. we need to change precedence of ~/bin in $PATH so that it appeared before /usr/local/bin (where original php interpreter sits) find ~/ -name .bash_profile | xargs sed -i 's/\$PATH:\$HOME/bin/\$HOME/bin:\$PATH/g'

  3. reload .bash_profile source ~/.bash_profile

sourced from: http://webiga.com/2013/06/22/change-default-version-of-php-at-webfaction/


The problem for me was that drush was not working with the correct PHP version, I think the problem was that it was using PHP 7, and I needed PHP 5.6. So I ran in the console:

whereis php

And the result was (see the PHP path for 5.6): enter image description here

Then I went to my ~/.bashrc file and added one line that sets PHP path for drush (and save):

export DRUSH_PHP=/usr/bin/php5.6

Then I updated .bashrc with the following (don't miss the point in the start of the command):

. ~/.bashrc

And that's it! Hope that helps!


I just ran into this after upgrading Drush on Windows. The server has an older version of PHP running and it wasn't picking up the version of PHP that came with Drush.

I was able to fix it by specifying the path to php.exe in the drush.bat file, located at

c:\documents and settings\all users\application data\drush\drush.bat

I just added the full path to PHP by changing this line:

@php.exe "%~dp0drush.php" --php="php.exe" %* to this:

@"c:\program files\drush\php\php.exe" "%~dp0drush.php" --php="php.exe" %*


Assuming you installed drush with composer and you want to run your command using php 7 (this works for acquia cloud envs too)

/usr/local/php7.1/bin/php ../vendor/drush/drush/drush.php --php=/usr/local/php7.1/bin/php [your_drush_command_here]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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