Hi there,

I have drush set up on a server (manual install in the user home folder) where php is in "/usr/local/bin/php". The php location is defined in the alias of the remote server. Strange thing is that some commands work, but others don't.

drush @remote status works ok, and drush rsync @remote @local works as well. Drush sql-sync @remote @local doesn't work and gives above error.

Below is the debug log:
Bootstrap to phase 0. [0 sec, 3.67 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.89 MB] [bootstrap]
Loading drushrc "***/drushrc.php" into "home.drush" scope. [0.01 sec, 3.9 [bootstrap]
MB]
Cache HIT cid: 5.1-commandfiles-0-eb813ae76e61c037a830ab45461682b6 [0.01 sec, 3.92 MB] [debug]
Bootstrap to phase 0. [0.03 sec, 8.78 MB] [bootstrap]
Bootstrap to phase 0. [0.04 sec, 8.78 MB] [bootstrap]
Found command: sql-sync (commandfile=sql) [0.04 sec, 8.78 MB] [bootstrap]
Including /usr/share/php/drush/commands/sql/sync.sql.inc [0.06 sec, 8.81 MB] [bootstrap]
Calling drush command init function: drush_sql_sync_init [0.06 sec, 9.02 MB] [bootstrap]
Load alias @local [0.06 sec, 9.02 MB] [notice]
Load alias @remote [0.1 sec, 9.03 MB] [notice]
Backend invoke: ssh -p *** *** '/usr/bin/php ***/drush/drush.php [command]
--php=/usr/bin/php --backend=2 --verbose --debug
--root=*** --php=/usr/local/bin/php
sql-conf --all 2>&1' 2>&1 [0.19 sec, 9.06 MB]
ssh -p *** *** '/usr/bin/php ***/drush/drush.php [notice]
--php=/usr/bin/php --backend=2 --verbose --debug
--root=*** --php=/usr/local/bin/php
sql-conf --all 2>&1' 2>&1 [0.19 sec, 9.07 MB]
The command could not be executed successfully (returned: bash: /usr/bin/php: No such file [error]
or directory
, code: 127) [23.19 sec, 9.07 MB]
Backend invoke: /usr/bin/php /usr/share/php/drush/drush.php --php=/usr/bin/php --backend=2 [command]
--verbose --debug --root=*** --uri=*** sql-conf
--all 2>&1 [23.21 sec, 9.07 MB]
/usr/bin/php /usr/share/php/drush/drush.php --php=/usr/bin/php --backend=2 --verbose [notice]
--debug --root=*** --uri=*** sql-conf --all 2>&1
[23.21 sec, 9.07 MB]
The command sql-sync could not be initialized. [23.4 sec, 9.08 MB] [error]
Command dispatch complete [23.4 sec, 9.08 MB] [notice]
Peak memory usage was 11.25 MB [23.4 sec, 9.08 MB]

Comments

Category:bug» support
Status:Active» Fixed

When calling drush, make sure that the correct php appears in your PATH; if it does not, you should set the environment variable DRUSH_PHP. Make sure that you haven't set an incorrect php in any site alias file that you are using. If any of these things are not right, then you'll have problems with commands like sql-sync that cause Drush to call back in to itself. See the FAQ, currently #5 from the top of http://drupal.org/drush-faq.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Based on IRC conversation, OP has set %drush-script which is the path to `drush`not path to `php`. You need to set 'php' in your remote alias. See http://drupalcode.org/project/drush.git/blob/e30ac4f7f6023523268ec4cd6a5...

Title:"/usr/bin/php: No such file" when using sql-sync, no problem with other remote commandssql-conf call during sql-sync does not honor 'custom php' in a remote site alias.
Assigned:Unassigned» greg.1.anderson
Category:support» bug
Priority:Normal» Minor
Status:Closed (fixed)» Active

Actually, OP got sql-sync to work once he added a db-url so it seems that the 'php' element does not work for the sql-conf call embedded within sql-sync

Updated log file:

drush -d sql-sync @remote @local
Bootstrap to phase 0. [0 sec, 3.76 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.98 MB] [bootstrap]
Loading drushrc "/x/drush/drushrc.php" into "home.drush" scope. [0.01 sec, 3.99 MB] [bootstrap]
Cache HIT cid: 5.7-commandfiles-0-dc58f0ea3927bd136ac615d099545a1a [0.01 sec, 4 MB] [debug]
Bootstrap to phase 0. [0.04 sec, 8.91 MB] [bootstrap]
Bootstrap to phase 0. [0.04 sec, 8.92 MB] [bootstrap]
Found command: sql-sync (commandfile=sql) [0.04 sec, 8.92 MB] [bootstrap]
Including /x/drush/source/commands/sql/sync.sql.inc [0.06 sec, 8.94 MB] [bootstrap]
Calling drush command init function: drush_sql_sync_init [0.06 sec, 9.16 MB] [bootstrap]
Loaded alias @local from file /x/.drush/aliases.drushrc.php [0.11 sec, 9.17 MB] [notice]
Loaded alias @remote from file /x/.drush/x.aliases.drushrc.php [0.14 sec, 9.18 MB] [notice]
Backend invoke: ssh -p 1338 x@x.x '/usr/bin/php /home/x/drush/drush.php --php=/usr/bin/php --backend=2 --verbose --debug [command]
--root=/home/x/domains/x/public_html --php=/usr/local/bin/php sql-conf --all 2>&1' 2>&1 [0.19 sec, 9.2 MB]
ssh -p 1338 x@x.x '/usr/bin/php /home/x/drush/drush.php --php=/usr/bin/php --backend=2 --verbose --debug [notice]
--root=/home/x/domains/x/public_html --php=/usr/local/bin/php sql-conf --all 2>&1' 2>&1 [0.19 sec, 9.21 MB]
The command could not be executed successfully (returned: bash: /usr/bin/php: No such file or directory [error]
, code: 127) [0.92 sec, 9.21 MB]
Backend invoke: /usr/bin/php /x/drush.php --php=/usr/bin/php --backend=2 --verbose --debug --root=/x/www/x [command]
--uri=x sql-conf --all 2>&1 [0.96 sec, 9.21 MB]
/usr/bin/php /x/drush.php --php=/usr/bin/php --backend=2 --verbose --debug --root=/x [notice]
--uri=x sql-conf --all 2>&1 [0.96 sec, 9.21 MB]
The command sql-sync could not be initialized. [1.15 sec, 9.22 MB] [error]
Command dispatch complete [1.15 sec, 9.22 MB] [notice]
Peak memory usage was 11.39 MB [1.15 sec, 9.22 MB]

it looks like the backend invoke ignores the php setting in the remote alias.

As suggested in IRC I'm posting a related problem. When using rsync with %files, the %files part on the remote alias doesn't get translated although a drush status @remote show the correct files path. When doing a debug it seems the error is similar and backend invoke is called with the wrong php path (setting the %files path in the alias fixes this problem).

Status:Active» Fixed

Fixed in 'master' and '7.x-5.x' branches. Sorry I misdiagnosed the problem the first time.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.