How to Test PHP in a Server

You can use or test PHP script (even PHP SSIs) only on a web server that supports PHP. If you’re creating a website on your own computer — as a way of teaching yourself to create websites, or as a way of developing content before posting it to a server — that’s actually a good plan.

But it won’t work to test PHP on your computer without special server software — software that, among other things, runs PHP scripts (usually).

What does that mean? And how do you get one of those PHP servers?

To be clear: You can create PHP files, but again, you can’t test them without posting them to a server.

Your options? Essentially two:

Contract with a web-hosting company that explicitly promises PHP support. If you search through the features offered by web-hosting packages, you’ll either find a specific acknowledgment that the hosting service supports PHP, or you won’t.

The figure shows the kind of wording that tips you off to the fact that a discount hosting service does not support PHP, or requires that you upgrade (for extra money and extra hassle) to enable PHP. If you think there is any chance you might use PHP at any time, including for SSIs, move on to another host provider.

Any hosting service that supports PHP will clearly say so. Here is a bit of the documentation at the FatCow hosting site, with the current versions of PHP supported. PHP is a free, open source program, and hosting services that offer PHP are likely to maintain the current version.

Install WAMP or MAMP and save, and test your files in the folder created for web pages.

Expect to spend some time installing one of the ’AMPs: This is software aimed at developers. This is free, open source software, and you aren’t going to get the kind of help installing and configuring it that you would expect from an Adobe or Microsoft product.

If the prospect of spending some time at online sites looking up error codes and sorting through conflicting advice on how to solve them seems like too much hassle, you might want to opt for a web-hosting service that supports PHP for about $5 (U.S.) per month to host your site and let you test your PHP there.

Tested at a server that supports PHP, an embedded menu bar looks like the one shown here.