Skip to Content
Learning PHP
book

Learning PHP

by David Sklar
April 2016
Beginner
550 pages
9h 40m
English
O'Reilly Media, Inc.
Content preview from Learning PHP

Appendix A. Installing and Configuring the PHP Engine

If you want to write some PHP programs, you need a PHP engine 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 with a cheap or free web-hosting provider that offers PHP—but you can run the PHP engine 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 website 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 URL for your site (e.g., http://www.example.com/phptest.php). If you see just the message PHP enabled, then your website host 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.

Installing the PHP Engine

Installing the PHP engine on your own computer is a good idea if you don’t have an account with a hosting ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning PHP 5

Learning PHP 5

David Sklar
Learning PHP 7

Learning PHP 7

Antonio L Zapata (GBP)
Advanced PHP Programming

Advanced PHP Programming

George Schlossnagle

Publisher Resources

ISBN: 9781491933565Errata PageSupplemental Content