|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-01 23:43 UTC] sniper@php.net
[2005-09-15 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 18:00:01 2025 UTC |
Description: ------------ I have a CLI PHP script that is run via cron. Most of the time (about 75%) it runs without issue. Sometimes, however, I get output similar to the following in my log file: [01-Sep-2005 13:30:40] PHP Notice: Undefined index: HOME in /path/to/file.php on line xx [01-Sep-2005 13:30:40] Array ( [PATH] => /bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices [PWD] => / [SHLVL] => 3 [_] => /usr/sbin/httpd ) Note that PHP and only PHP writes into this log file. Reproduce code: --------------- $scriptdir = "$_ENV[HOME]/automation"; error_log(print_r($_ENV,true)); Expected result: ---------------- I expect to see the $_ENV array printed into the log file, with the name of the currently running php script in $_ENV['_']. I also expect to see no error from the line that references $_ENV['HOME']. Here is a "normal" entry, generated by the exact same script: [01-Sep-2005 13:46:01] Array ( [SHELL] => /bin/sh [USER] => wbd [SCRIPT_PATH] => /Users/wbd/automation [PATH] => /usr/bin:/bin [PWD] => /Users/wbd [SHLVL] => 1 [HOME] => /Users/wbd [LOG_PATH] => /Users/wbd/automation/_logs [LOGNAME] => wbd [_] => /Users/wbd/automation/_shared/everyMinute.php [__CF_USER_TEXT_ENCODING] => 0x1F5:0:0 ) Actual result: -------------- See log entry above.