̃Gg[͂ĂȃubN}[Nɒlj

PHP :: スーパーグローバル変数 $_SERVER を var_dump してみる



cron

server.php

<?php var_dump($_SERVER); ?>

crontab

* * * * * /usr/local/bin/php /home/apache/htdocs/server.php > /tmp/server.txt

出力

% less /tmp/server.txt
array(15) {
  ["SHELL"]=>
  string(7) "/bin/sh"
  ["USER"]=>
  string(5) "superman"
  ["PATH"]=>
  string(13) "/usr/bin:/bin"
  ["PWD"]=>
  string(11) "/home/superman"
  ["SHLVL"]=>
  string(1) "1"
  ["HOME"]=>
  string(11) "/home/superman"
  ["LOGNAME"]=>
  string(5) "superman"
  ["_"]=>
  string(18) "/usr/local/bin/php"
  ["PHP_SELF"]=>
  string(34) "/home/apache/htdocs/server.php"
  ["SCRIPT_NAME"]=>
  string(34) "/home/apache/htdocs/server.php"
  ["SCRIPT_FILENAME"]=>
  string(34) "/home/apache/htdocs/server.php"
  ["PATH_TRANSLATED"]=>
  string(34) "/home/apache/htdocs/server.php"
  ["DOCUMENT_ROOT"]=>
  string(0) ""
  ["argv"]=>
  array(1) {
    [0]=>
    string(34) "/home/apache/htdocs/server.php"
  }
  ["argc"]=>
  int(1)
}



programming/php/etc/server/cron.txt