Server Variables Revisited

You have already encountered the predefined elements that PHP, in conjunction with your server, stores in the superglobal $_SERVER array. Generally, $_SERVER elements are made available to PHP by the server (or the shell if you are running a script from the command line). If you are running Apache, all the elements we discuss will likely be accessible to you. If you are running another server, there is no guarantee that $_SERVER will have been populated with all the elements discussed in this hour, so you should check before using them in scripts. Table 14.1 lists some of the $_SERVER elements you might be able to use to find out more about your visitors (see Table 10.1 for a more complete list of $_SERVER elements). ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.