Drush: Wrong PHP version when trying to sql-sync with SSH I'm trying to upload a database on the server with SSH by using sql-sync, but I'm getting the following error:


  PHP Parse error: syntax error, unexpected '{' in /home/luken/programs/drush/includes/environment.inc on line 517 X-Powered-By: PHP/4.4.7 Content-type: text/html [...]


As you see from the error message, it is using PHP 4.4.7, while I want to use PHP 5.4.

I tried adding the following line to .bash_profile.

export DRUSH_PHP=php54 (that is php version I wanted to use, and it works when I normally log in)


I also tried with PATH=/home/luken/programs/drush:${PATH}.

What else can I do?

phpinfo() gives this path to PHP: /usr/local/php54/.

Breaking news:

Ok, now I'm totally confused, it appeared that the whole database WAS copied, regardless of error that sql-sync has been producing (suggesting that nothing has been accomplished). I hope that anyone who will get this error will check now if it really didn't do anything, and now the winner will be the one who can explain that O_o.
Check the user that is specified in your Drush alias file.  From the error message above, my guess is that you have configured your alias file to use the web server user, and your web server user is probably not configured to use php-cli -- that's probably why you're getting an old php-cgi instead.  Log in as the web server user (you may need to edit /etc/passwd and change the shell to /bin/bash first), and then configure your path and DRUSH_PHP environments as you describe above.

Alternately, you could use some other user in your Drush alias file.  I like to create a user called 'www-admin', or something similar, and make all of my web files owned by that user.