24th Nov2011

PHP Server Variables

I know when I first started out learning PHP it was difficult finding good examples or live demos of simple PHP in use. Often I’d have a large number of files used to demonstrate built in PHP functions. So, to help any budding PHP developers out there I compiled a list of the PHP Server variables along with what data they provide. 

$_SERVER variables can be used in multiple ways from getting information about your visitors to script security.  For example, by using HTTP_HOST you can be sure that your web applications work regardless the domain.  For my own custom scripts I use the PHP_SELF variable with the dirname() function to get the base directory URL for requiring necessary files regardless the scripts domain or folder location.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>