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.

Command icon 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

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Assigned: Unassigned » phenaproxima

This is a bit complicated and low-level, so self-assigning to deal with it.

phenaproxima’s picture

Title: If the PHP interpreter is not in the PHP interpreters' PATH, the Composer executable may not run » If the PHP binary is not in the PHP interpreter's PATH, Composer invocations fail

phenaproxima’s picture

Status: Active » Needs review

Turns 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.

tedbow’s picture

Status: Needs review » Reviewed & tested by the community

  • phenaproxima committed 2437240 on 8.x-2.x
    Issue #3275324 by phenaproxima: If the PHP binary is not in the PHP...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Merged into 8.x-2.x.

Status: Fixed » Closed (fixed)

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