Problem/Motivation
Well, this is awkward, but in Automatic Updates, we have a situation where the PHP interpreter is trying to execute another, external command which uses the PHP interpreter: Composer.
Composer's executable, like most PHP-based executables, begins with /usr/bin/env php. Usually that's fine...but if php is not in the PATH of the environment where Composer is being invoked, it will fail. That pretty much completely breaks this module.
Steps to reproduce
Try to do anything with Automatic Updates in a situation where the PHP interpreter does not have the php binary in its PATH.
Proposed resolution
The Composer runner service (provided by Composer Stager, potentially overridable by us) should probably prefix the Composer command invocations with the value of the PHP_BINARY constant. It's unclear how that will work if PHP_SAPI is something other than cli, but it definitely improves the chances of this working.
Remaining tasks
Do it, and add some sort of unit test which proves that Composer is invoked by the PHP interpreter directly.
Issue fork automatic_updates-3275324
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
phenaproximaThis is a bit complicated and low-level, so self-assigning to deal with it.
Comment #3
phenaproximaComment #5
phenaproximaTurns out that PHP already provides a constant that does what we need: PHP_BINDIR. My local testing seems to indicate that it works consistently even if PHP is being used in a FastCGI/FPM set-up, which is not true of PHP_BINARY.
Comment #6
tedbowComment #8
phenaproximaThanks! Merged into 8.x-2.x.