Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Server Variables

Are these available PHP $_SERVER variables

12:52 am on Jun 20, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:May 3, 2011
votes: 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.
2:44 pm on June 20, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:July 25, 2006
posts: 460
votes: 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.
4:45 pm on June 20, 2012 (gmt 0)

Senior Member

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

joined:Nov 28, 2004
votes: 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). :-)
4:07 am on June 21, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:May 3, 2011
votes: 0

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