我如何才能获得唯一ID阿帕奇? [英] How can I access Unique ID in apache?
问题描述
如何访问阿帕奇跟踪每个请求UNIQUE_ID?我想跟踪它在它调用的任何PHP脚本,以及有它记录为每个请求。
How can I access the unique_id that apache tracks for each request? I'd like to track it in any php scripts it calls as well as have it logged for each request.
我从的http.conf
文件中删除以下行注释:
I remove comment on the following line from http.conf
file:
LoadModule unique_id_module libexec/apache2/mod_unique_id.so
和我想引用ID在这个简单的PHP脚本:
and I am trying to reference the ID in this simple php script:
<?php
print("Hello world\n");
print($_SERVER['UNIQUE_ID']);
?>
然而,这个脚本只返回的Hello World
。
这是可能的吗?我运行MacOS的,如果有什么差别。
Is this possible to do? I'm running macos if that makes any difference.
的$ _ SERVER一个的var_dump如下:
A var_dump of $_SERVER is as follows:
array(29) { ["HTTP_HOST"]=> string(9) "localhost"
["HTTP_CONNECTION"]=> string(10) "keep-alive"
["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0"
["HTTP_ACCEPT"]=> string(74) "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" ["HTTP_USER_AGENT"]=> string(120) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36" ["HTTP_ACCEPT_ENCODING"]=> string(17) "gzip,deflate,sdch"
["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.8"
["HTTP_COOKIE"]=> string(11) "undefined=0"
["PATH"]=> string(186) "/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/local/lib/postgresql84/bin:/Applications/XAMPP/xamppfiles/bin"
["SERVER_SIGNATURE"]=> string(0) ""
["SERVER_SOFTWARE"]=> string(67) "Apache/2.2.24 (Unix) DAV/2 PHP/5.3.26 mod_ssl/2.2.24 OpenSSL/0.9.8y"
["SERVER_NAME"]=> string(9) "localhost"
["SERVER_ADDR"]=> string(3) "::1"
["SERVER_PORT"]=> string(2) "80"
["REMOTE_ADDR"]=> string(3) "::1"
["DOCUMENT_ROOT"]=> string(28) "/Library/WebServer/Documents"
["SERVER_ADMIN"]=> string(15) "you@example.com"
["SCRIPT_FILENAME"]=> string(35) "/Library/WebServer/Documents/id.php"
["REMOTE_PORT"]=> string(5) "49669"
["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1"
["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1"
["REQUEST_METHOD"]=> string(3) "GET"
["QUERY_STRING"]=> string(0) ""
["REQUEST_URI"]=> string(7) "/id.php"
["SCRIPT_NAME"]=> string(7) "/id.php"
["PHP_SELF"]=> string(7) "/id.php"
["REQUEST_TIME"]=> int(1397681759)
["argv"]=> array(0) { }
["argc"]=> int(0) }
我在同一地区有另一个问题可能指向手头的问题:<一href=\"http://apple.stackexchange.com/questions/127801/where-are-the-apache-config-files-stored?noredirect=1#comment149749_127801\">http://apple.stackexchange.com/questions/127801/where-are-the-apache-config-files-stored?noredirect=1#comment149749_127801
推荐答案
我不得不做了 / usr / sbin目录/的httpd -k停止
,然后一个 / usr / sbin目录/的httpd -k启动
来获得配置服用。不确定为什么须藤apachectl中重启
看上去就像是重新启动,但它不是....
I had to do a /usr/sbin/httpd -k stop
and then a /usr/sbin/httpd -k start
to get the config to take. Unsure why sudo apachectl restart
LOOKED like it was restarting, but it wasn't....
这篇关于我如何才能获得唯一ID阿帕奇?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!