简体   繁体   中英

Difference in PHP GLOBALS between apache/linux versions

This might be a better way to ask a question I have about php and apache. I have two servers and they have very different global variables when I print_r($GLOBALS) from php. The differences are below. Can someone explain why the test server call doesn't show ANY _SERVER settings?

—————— configuration from test server running 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 ——————

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. the core php.ini directives allow you to get/set the PHP setup configuration. So, try to set auto-globals-jut = 1 before using print_r(...) see this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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