Appendix A. Installing and Configuring the PHP Interpreter
If you want to write some PHP programs, you need a PHP interpreter to turn them from punctuation-studded text files into actual interactive web pages. The easiest way to get up and running with PHP is to sign up for a cheap or free web-hosting provider that offers PHP—but you can run the PHP interpreter on your own computer, too.
Using PHP with a Web-Hosting Provider
If you already have an account with a web-hosting provider, you probably have access to a PHP-enabled server. These days, it is the odd web-hosting provider that doesn’t have PHP support. Usually, hosting providers configure their servers so that files whose names end in .php are treated as PHP programs. To see whether your hosted web site supports PHP, first save the file in Example A-1 on your server as phptest.php.
<?php print "PHP enabled"; ?>
Load the file in your browser by visiting the right URL for your site (e.g.,
http://www.example.com/phptest.php). If you see just the message
PHP enabled, then your hosted web site supports
PHP. If you see the entire contents of the page (
enabled"; ?>), then your hosting provider probably
doesn’t support PHP. Check with them, however, to make sure that they haven’t turned on
PHP for a different file extension or made some other nonstandard configuration choice.
If you can’t use PHP with your web hosting provider (or you don’t have one), the links at http://www.php.net/links.php#hosts ...