简体   繁体   English

apache / linux版本之间PHP GLOBALS的差异

[英]Difference in PHP GLOBALS between apache/linux versions

This might be a better way to ask a question I have about php and apache. 这可能是问我关于php和apache的问题的更好方法。 I have two servers and they have very different global variables when I print_r($GLOBALS) from php. 我有两个服务器,当我从php进行print_r($GLOBALS)时,它们具有非常不同的全局变量。 The differences are below. 区别如下。 Can someone explain why the test server call doesn't show ANY _SERVER settings? 有人可以解释为什么测试服务器调用不显示任何_SERVER设置吗?

—————— configuration from test server running Ubuntu 13.10 ——————— ——————从运行Ubuntu 13.10的测试服务器上进行配置————————

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

    [_POST] => Array
        (
        )

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

    [_FILES] => Array
        (
        )

    [GLOBALS] => Array
 *RECURSION*
)

———— configuration from production server running Ubuntu 12.04 —————— ————从运行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
)

Check if both php.ini files are the same. 检查两个php.ini文件是否相同。 the core php.ini directives allow you to get/set the PHP setup configuration. 核心php.ini指令允许您获取/设置PHP安装程序配置。 So, try to set auto-globals-jut = 1 before using print_r(...) see this link 因此,在使用print_r(...)之前尝试设置auto-globals-jut = 1参见此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM