Specifications
Note that the environment we are talking about here is the environment in which PHP runs on
the server.
You can get a list of all PHP’s environment variables by running phpinfo(). Some are more
useful than others; for example,
getenv(“HTTP_REFERER”);
will return the URL of the page from which the user came to the current page.
You can also set environment variables as required with putenv(), for example,
$home = “/home/nobody”;
putenv (“ HOME=$home “);
If you would like more information about what some of the environment variables represent,
you can look at the CGI specification:
http://hoohoo.ncsa.uiuc.edu/cgi/env.html
Further Reading
Most of the file system functions in PHP map to underlying operating system functions—try
reading the man pages if you’re using UNIX for more information.
Next
In Chapter 17, “Using Network and Protocol Functions,” we’ll use PHP’s network and protocol
functions to interact with systems other than our own Web server. This again expands the hori-
zons of what we can do with our scripts.
Advanced PHP Techniques
P
ART IV
368
21 7842 CH16 3/6/01 3:40 PM Page 368










