Why is www's $PATH only /usr/bin:/bin?

Luca Ferrari fluca1978 at infinito.it
Wed Apr 27 08:22:34 UTC 2016


On Wed, Apr 27, 2016 at 9:21 AM, Steve O'Hara-Smith <steve at sohara.org> wrote:
> On Tue, 26 Apr 2016 21:40:48 +0200
>         ... and indeed cannot log in so the login.conf is not going to
> apply. It is also possible (indeed likely) that the web server deliberately
> minimises the path passed to CGI scripts for security.

Exactly. You have to think that PATH can be changed by the running
process, so there is no surprise that is either expanded or shrinked.

>> The thing is that I want to run something in /usr/local/bin with PHP's
>>
>>     shell_exec($cmd);
>>
>> but that's not working because it's not in $PATH.

I would suggest to either add the path to the php config or to make a
php function to build the absolute path for command based on your
installation or some other condition. That would make the application
portable.


Luca


More information about the freebsd-questions mailing list