Homec4science

Detect empty $PATH environmental var

Authored by epriestley <git@epriestley.com> on Jan 16 2012, 15:27.

Description

Detect empty $PATH environmental var

Summary:
By default, PHP-FMP (an alternate PHP FCGI SAPI) cleans the entire environment
for child processes. This means we have no $PATH.

This causes some confusing failures for reasons I don't fully understand. If you
do these things:

exec_manual('env');
exec_manual('export');

...they show no $PATH, as expected. If you do this:

exec_manual('echo $PATH');

...it shows a path. And this works (i.e., it finds the executable):

exec_manual('ls');

...but this fails (it says "no ls in ((null))"):

exec_manual('which ls');

So, basically, the sh -c process itself gets a default PATH somehow, but its
children don't. I don't realllly get why this happens, but clearly an empty
$PATH is a misconfiguration, and can easily be remedied.

See discussion here: https://github.com/facebook/libphutil/issues/7

Test Plan: Applied patch to Centos6 + nginx + PHP-FPM machine, ran setup, the
configuration issue was detected and I was given information on resolving it.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D1413

Details

Committed
epriestley <git@epriestley.com>Jan 16 2012, 20:49
Pushed
aubortJan 31 2017, 17:16
Parents
rPHf81021fa7f2e: Improve error message for Conduit path problems
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH80643d63a8f8: Detect empty $PATH environmental var (authored by epriestley <git@epriestley.com>).Jan 16 2012, 20:49