Chapter 4:
System Requirements

Google

Here, I'm referring to the requirements for your Web host. These are things you'll need to have in place before running any scripts written in PHP. The more of these items that can be verified and checked off your list before you begin, the smoother and quicker the installation will be.

When you're installing a script/program/page written in PHP, you may need to know which version of PHP is installed on the server. It may or may not be compatible with your script or program! This doesn't happen often, and most any script you find online will tell you if it needs a certain version of PHP.

For those of you who are really serious about learning PHP, I strongly recommend that you get a book that comes with a CD-ROM. This CD-ROM should have the code described in the book, a PHP interpreter and other supporting files that you can install on your own PC. Once you've installed this code, you can write and, more importantly, debug PHP scripts before you try to install them on your Web server.

In many cases, the CD-ROM will also include a "web server" program that you can use to make your PC act like a web host. This will give you a total web environment where you can verify all of your code's behavior before you upload it to your own site. No one will ever see your mistakes (if you made any...<grin>).

The Root path

Some scripts will need to know the "root path". Most will work using a "virtual" or "relative" path, but others won't. Get this information from your host administrator. Be sure they give you the actual path. Sometimes the diagnostic scripts return a virtual path.


The PHP environment

Here is a list of the standard environment variables:

  • $SERVER_SOFTWARE - the server identification string given in the headers when responding to requests
  • $GATEWAY_INTERFACE - the revision of the CGI specification the server is using; usually it's 'CGI/1.1'
  • $DOCUMENT_ROOT - the document root directory under which the current script is running
  • $REMOTE_ADDR - the IP address from which the user is viewing the current page
  • $SERVER_PROTOCOL - the name and revision of the information protocol which requested the page; for example, 'HTTP/1.0'
  • $REQUEST_METHOD - the request method used to access the page: 'GET', 'HEAD', 'POST', 'PUT'
  • $PHP_SELF - the filename of the currently executing script relative to the document root
  • $REMOTE_HOST - the host name from which the user is viewing the current page
  • $HTTP_REFERER - the address of the page (if any) which referred the user agent to the current page
  • $QUERY_STRING - the query string, if any, via which the page was accessed
  • $HTTP_USER_AGENT - the contents of the User-Agent: header from the current request if there is one. This is a string denoting the user agent(browser) which was used to access the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)
  • $HTTP_ACCEPT - the contents of the Accept: header from the current request, if there is one
  • $REMOTE_PORT - the port being used on the user's machine to communicate with the web server
  • $HTTP_ACCEPT_LANGUAGE - the contents of the Accept-Language: header from the current request, if there is one
  • $SCRIPT_NAME - the virtual path to the script, available as an environment variable for CGI scripts.
  • $SCRIPT_FILENAME - the absolute pathname of the currently executing script
  • $SERVER_NAME - the name of the server host on which the current script is running
  • $REQUEST_URI - the URI which was given in order to access this page; for instance, '/index.html'
  • $HTTP_ACCEPT_CHARSET - the contents of the Accept-Charset: header from the current request, if there is one
  • $SERVER_PORT - the port on the server machine being used by the web server for communication
  • $HTTP_HOST - the contents of the Host: header from the current request, if there is one
  • $SERVER_ADMIN - the value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file
Previous Page   Table of Contents   Next Page

Copyright © 2004 Steve Humphrey