I just updated Drush from 4.5 to 5.8 and even though it appears to work fine, I get this notice after every command: "php-cli: not found". My OS is FreeBSD, so there is no PHP extension php-cli (or PHP5-cli) as there is in Linux. Php-cli is included when PHP is compiled from ports.

If Drush isn't using php cli, what is it using, and how can I get rid of this notice? I didn't have it with Drush 4.5, though it's been a while and I vaguely remember dealing with this before and don't recall what I did to fix it (if I did) - maybe something to do with the environment variable?

Thanks, Jeff

Comments

greg.1.anderson’s picture

Drush uses php-cli if it is available; it tests for availability by running php-cli -v >/dev/null 2>&1. The output redirection should cause stdout and stderr to be redirected; this suppresses the error message on Linux when using Bash.

Are you using Bash, or some other shell? Try typing the command above, and see if you get the same error message that you do when running Drush. (You should.) Try other variants, such as php-cli -v >/dev/null 2>/dev/null, and see which suppress the error message, but still set $?.

druplicate’s picture

Both commands resulted in: "Ambiguous output redirect."
I'm using C shell on FreeBSD, not Linux.
Surely there must be a more universal way to test the availability of PHP CLI that works for all flavors of Unix.
There is no separate CLI add-on for PHP in FreeBSD - it's just a compilation option at build time.
If Drush can't find the extension, how does it use PHP?
Why wasn't this a problem with Drush 4.5?

Thanks,

Jeff

greg.1.anderson’s picture

Open up the 'drush' script in Drush 4.5 and see. Maybe it used some other technique such as 'which drush'.

In general, though, Drush does not support the C shell. Would it work for you to use Bash with Drush? We could, of course, consider any patches you might submit for C shell compatibility, but they would also have to work on Bash.

druplicate’s picture

FreeBSD defaults to the tcsh shell, but bash is available, just not in the same place it is in Linux.

I just changed the script's first line from: #!/usr/bin/env sh

to: #!/usr/local/bin/bash

and the annoying error message went away.

I pointed this out to the port maintainer - hopefully he'll patch the script.

Maybe you could also make the script smarter by searching for the location of bash.

...Jeff

druplicate’s picture

Status: Active » Fixed
RedRat’s picture

Or you can just put this line in .cshrc:

setenv DRUSH_PHP /usr/local/bin/php

greg.1.anderson’s picture

See also #1939982: drush launcher reports `php-cli: not found` by default, which provides a good resolution to this problem. The fix there is already committed to 8.x-6.x and 7.x-5.x; please re-open if you have any further problems with the Drush script on FreeBSD on the dev version of Drush 6 or Drush 5.

Status: Fixed » Closed (fixed)

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