People are always having issues where they are using the wrong php - the php.ini status is a good help, but I don't know if it is always enough for people to diagnose the issue. Checking the actual executable seems like a useful thing for people to be able to validate (and for us to see in bug reports), and it's easy enough to display.

The attached patch just displays the php passed in via the php option. I think this should work all the time if you call drush using the shell wrapper. It _is_ possible to confuse it if you (for example) call "/usr/local/bin/php drush.php --php=/usr/bin/php" or similar, but honestly if you are doing that you can probably work it out. Detecting the actual php executable (with full path) drush is running as is really hard to do cross platform (OS X having no procfs being one issue), which is why we use the shell wrapper.

Thoughts?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greg.1.anderson’s picture

Seems good to me.

moshe weitzman’s picture

Status: Needs review » Patch (to be ported)

Committed to 6. Does not apply cleanly to 5. Feel free to port it and commit

jonhattan’s picture

Version: 8.x-6.x-dev » 7.x-5.x-dev
greg.1.anderson’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.25 KB

Continuing on this theme, how about we also put PHP_OS into the Drush Status output? Sure, the end user will always know what OS they are running on, but sometimes it's not immediately obvious in issues. With this addition, it would at least be clear in those instances where the output of drush status is included as recommended.

greg.1.anderson’s picture

Version: 7.x-5.x-dev » 8.x-6.x-dev
jonhattan’s picture

Status: Needs review » Reviewed & tested by the community

PHP_OS is 'Linux' for any GNU/Linux distro. Beyond that, it may be useful to detect a variety of OSes. http://stackoverflow.com/questions/738823/possible-values-for-php-os

greg.1.anderson’s picture

In an issue report, I mostly care about Windows / Mac / Linux-variant. If folks care which Linux variant, we could try harder to find the distro when PHP_OS says Linux.

Owen Barton’s picture

I think the specific distro/OS and (especially) version is pretty useful information - although I am fine with starting with the OS, since that is useful too.

Note that PHP_OS actually displays the build OS rather than the running OS (I am not sure I can think of realistic situations where this might be different...embedded QNX perhaps?).

For Linux distro versions, there are normally some clues in php_uname() output for Linux at least, but there is a lot of unrelated details there (I don't think we care about kernel version, for instance). For Linux you can get the most useful structured information from the "lsb_release -a" command, although I think that is an optional install on Redhat distros (at least, it was at some point). The other option is looking at /etc/*release files - there is some sample code at http://stackoverflow.com/a/16338644. Including lsb_release if it is available seems like the simplest option though. I have no idea what the equivalent is on OS X or Windows.

moshe weitzman’s picture

Status: Reviewed & tested by the community » Needs work

needs reroll - sorry.

moshe weitzman’s picture

Issue tags: +Novice

Can anyone reroll this?

greg.1.anderson’s picture

Status: Needs work » Needs review
FileSize
3.25 KB

Here's a reroll of #4.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed

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