Previous Section  < Day Day Up >  Next Section

A.1 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.

Example A-1. PHP test program
<?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 (<?php print "PHP 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 are a good place to start when looking for a web-hosting provider that supports PHP.

    Previous Section  < Day Day Up >  Next Section