From owner-freebsd-questions@freebsd.org Wed Apr 27 12:12:21 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DC9BB1D61C for ; Wed, 27 Apr 2016 12:12:21 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1D88167B for ; Wed, 27 Apr 2016 12:12:19 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from becker.bs.l ([85.180.12.177]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0Lx4sD-1bkANN49vd-016jfN for ; Wed, 27 Apr 2016 14:07:05 +0200 Received: from bsch by becker.bs.l with local (Exim 4.87 (FreeBSD)) (envelope-from ) id 1avOFE-000Lu8-C3 for freebsd-questions@freebsd.org; Wed, 27 Apr 2016 14:07:04 +0200 Date: Wed, 27 Apr 2016 14:07:04 +0200 From: Bertram Scharpf To: freebsd-questions@freebsd.org Subject: Re: Why is www's $PATH only /usr/bin:/bin? Message-ID: <20160427120704.GA77440@becker.bs.l> Mail-Followup-To: freebsd-questions@freebsd.org References: <20160426194048.GA31481@box-fra-01.niklaas.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160426194048.GA31481@box-fra-01.niklaas.eu> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: Bertram Scharpf X-Provags-ID: V03:K0:+xIvc8fdlldEnfAjYCqqkAg2TrUgE2K+6UY4Op5qua3cv1QxvI9 4vUt2IiRfAovGTIsvinReG8QK1bqUCnqqEmOL38mkd5apYTI5kxX6Qq1HFzCW5AeIoPOXQ9 /2JFL97qKn07IfuVWdlKf9dhZcEUd7PFxqC4v2aCNmaS10gNyk+yiE1n2tbgqWZy4sEjSD/ AweOkuSgexfAdwiEKW1sg== X-UI-Out-Filterresults: notjunk:1;V01:K0:jRqKCCxkAx4=:Qp897PqaFIG9U3dnT1xdVE fvZZMr3/wVGkVFzTNeEMfxmCfyiwWURKhgmUhemmuECPhsX0r+5vKDi79PBzhH5KaeLjCSmdK IWkSWLoVg0N+nUyCTUWdyW9Mtvctimb5m9Mf34OY61s1mpK7u2QzepqC9dqwBZoVjCTpvUtma MDAb1BSVi4Msw2f6Urch46HhfsHdP19jBekUN8wi++ZN5HEv2uMneUnunpQDxNJBDzz4Wbc0V xI1M/pchn3IAnRK4l1Cpv8yM9ASK8rpmo30tCV6snbMz+DWKxGWIQ7qDWt8tSFZRJCRLsGEEV P9LwSy3qfXKXxqs/nSDC1JpU/ybc5pVClh9QNCuOIA+8ebLnYkRv2vpSUWopZTrDlAVsM+ZD7 Us3GX/RXJQKiopoFA+Yswh3cPS8RygyydFGrSkmPz3MieR3mmLbtZgeI7Iizj/F80x4VtSEJ6 zU2cSaxqL0PzOxhHc/xiy80xp0q7KPdMvOEU+6oT9CD+jf5XcF5OY1UsfZ538uBCwdf1TAKPF 4rmMTsHjdu0+y2tpB3zV40SZL348mUXvKCIY7vtC24wCHDuFcEQJum5FA/Qax16Jl4RQ3B1e1 6A3V1JSnrVIcQUCx26C2pzl89dv0vQnXpbrx+fFNsCdXtfuC2u9MvR6HwmdOd/CyBv1nIxkoT MwBnt/8/fdfUldv7JOTes47eWqydomHpEbO6CIKAed1we1G8Bs/8PsyhOrV1sdCf798c= X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 12:12:21 -0000 On Tuesday, 26. Apr 2016, 21:40:48 +0200, Niklaas Baudet von Gersdorff wrote: > I figured that www's $PATH is only /usr/bin:/bin. Why is that if > /etc/login.conf says the following? > > default:\ > --------8<-------- > :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\ > --------8<-------- > 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 wondered as well about this behaviour sometimes. The default path from login.conf will be set at login. Yet, the www daemon is started from rc and this is not understood to be a login. The perverse thing is that when you do a "/usr/local/etc/rc.d/apache24 restart" from the command line, then the PATH variable will contain the value you expect. I recommend to include a line into your Apache configuration (or whichever HTTP server you use) like SetEnv PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin Cron does the same by "PATH=..." as you can see in "/etc/crontab". There is no possibility to do this in lpd, wherefore I wrote a bug report. Have a look at the description. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de