apache / linux版本之间PHP GLOBALS的区别

时间:2014-03-20 20:11:30

标签: php linux apache ubuntu

这可能是一个更好的方式来问我有关php和apache的问题。我有两个服务器,当我从php print_r($GLOBALS)时它们有非常不同的全局变量。差异如下。有人可以解释为什么测试服务器调用没有显示任何_SERVER设置吗?

------从运行Ubuntu 13.10的测试服务器配置-------

Array
(
    [_GET] => Array
        (
            [r] => 2
        )

    [_POST] => Array
        (
        )

    [_COOKIE] => Array
        (
            [__utma] => etc
        )

    [_FILES] => Array
        (
        )

    [GLOBALS] => Array
 *RECURSION*
)

----从运行Ubuntu 12.04的生产服务器配置------

Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_POST] => Array
        (
        )

    [_GET] => Array
        (
            [r] => 1
        )

    [_COOKIE] => Array
        (
            [__utma] => etc
        )

    [_FILES] => Array
        (
        )

    [_REQUEST] => Array
        (
            [r] => 1
        )

    [_SERVER] => Array
        (
            [HTTPS] => on
            [SSL_TLS_SNI] => tgg.xxx.com
            [HTTP_HOST] => tgg.xxx.com
            [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0
            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
            [HTTP_ACCEPT_ENCODING] => gzip, deflate
            [HTTP_COOKIE] => xxx
            [HTTP_CONNECTION] => keep-alive
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] => 
Apache/2.2.22 (Ubuntu) Server at tgg.xxx.com Port 443

            [SERVER_SOFTWARE] => Apache/2.2.22 (Ubuntu)
            [SERVER_NAME] => tgg.xxx.com
            [SERVER_ADDR] => 192.241.179.123
            [SERVER_PORT] => 443
            [REMOTE_ADDR] => 67.79.197.222
            [DOCUMENT_ROOT] => /var/www/xxx
            [SERVER_ADMIN] => [no address given]
            [SCRIPT_FILENAME] => /var/www/xxx/index.php
            [REMOTE_PORT] => 60665
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_PROTOCOL] => HTTP/1.1
            [REQUEST_METHOD] => GET
            [QUERY_STRING] => r=1
            [REQUEST_URI] => /index.php?r=1
            [SCRIPT_NAME] => /index.php
            [PHP_SELF] => /index.php
            [REQUEST_TIME] => 1395338407
        )

    [ignoreAuth] => 1
)

1 个答案:

答案 0 :(得分:0)

检查两个php.ini文件是否相同。 核心php.ini指令允许您获取/设置PHP设置配置。因此,在使用auto-globals-jut = 1之前尝试设置print_r(...)this link