|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65223 $_SERVER, $_ENV, $_REQUEST variables missing in $GLOBALS
Submitted: 2013-07-09 10:40 UTC Modified: 2013-07-09 12:07 UTC
From: truenrush at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.17 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: truenrush at gmail dot com
New email:
PHP Version: OS:


 [2013-07-09 10:40 UTC] truenrush at gmail dot com
When i did a var_dump($GLOBALS) i was surprized, because _SERVER variable was 
missing here, but standalone _SERVER var was working fine.

According to, 
"$GLOBALS is an associative array containing references to all variables which are 
currently defined in the global scope of the script".

_SERVER is defined in global space. But it does not appear in the $GLOBALS.
I found nothing on about such behaviour. 

Test script:

Expected result:
_SERVER key exists in $GLOBALS array.

Actual result:
_SERVER key does not exist in $GLOBALS array.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-09 11:20 UTC] truenrush at gmail dot com
-Summary: $_SERVER variable missing in $GLOBALS +Summary: $_SERVER, $_ENV, $_REQUEST variables missing in $GLOBALS
 [2013-07-09 11:20 UTC] truenrush at gmail dot com
I also found that $_ENV and $_REQUEST vars are also missing in $GLOBALS.

_SERVER variable appears in $GLOBALS when using php in cli mode, but with web 
server i can not find it in the $GLOBALS variable
 [2013-07-09 12:00 UTC]
-Status: Open +Status: Not a bug
 [2013-07-09 12:00 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

super-globals (aka. auto globals) are not added to symbol tables by defaultfor performance reasons unless the parser sees need. i.e. 


will list it. You can also control this using auto_gloals_jit in php.ini:
 [2013-07-09 12:07 UTC] truenrush at gmail dot com
Thanks for so fast response. I was near to blow my brain up.
Now i understand how it really works inside. Cool feature! :)
 [2020-12-29 00:01 UTC] galszabolcs810624 at gmail dot com
me too
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jun 26 21:05:45 2022 UTC