homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP Server Variables
Are these available PHP $_SERVER variables

Msg#: 4467431 posted 12:52 am on Jun 20, 2012 (gmt 0)

Ok, first off I'm a noob when it comes to PHP.

I'm just trying to find out if these are available server variables to PHP.

I've seen this link here:

and I was wondering if most of the server variables in mod_rewrite were also available.

Two especially.


So for PHP:

I've seen $_SERVER['HTTP_COOKIE'] being used, so I was wondering if $_SERVER['THE_REQUEST'] could be used. These are for a security script that I'm working on.

Any suggestions would be greatly appreciated.



5+ Year Member

Msg#: 4467431 posted 2:44 pm on Jun 20, 2012 (gmt 0)

When I run phpinfo(), I see an entry for _SERVER["HTTP_COOKIE"], so it exists. _SERVER['THE_REQUEST'] is not there, but it looks like you could replicate it manually using something like this:


It appears there are also equivalent values in the array of $_ENV[] variables.

Depending on how you want to see the cookie data, you might find the $_COOKIE[] array useful.


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4467431 posted 4:45 pm on Jun 20, 2012 (gmt 0)

Environment variables are available to any server site language; they come from the underlying server software, where it's 'nix, windows, or whatever-based.





in a mod_rewrite/.htaccess context:


AFAIK HTTP_COOKIE will **only** be available if a cookie (or cookies) has been set for the domain you're currently on. Sometimes this cookie is set by server software, whether you're doing it in your programming or not, and can be a session or persistent cookie. It's your job to loop through all the cookies in it and identify them by name (key). :-)


Msg#: 4467431 posted 4:07 am on Jun 21, 2012 (gmt 0)

Thanks for the replies. @rocknbil, you answered my question exactly. Thanks again.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved