WWW FAQs: How do I test PHP, ASP, server side include and CGI pages offline or at home?

2005-10-30: PHP, ASP, server-side include (SSI), and CGI are all server-side technologies. And that means you need a web server to test them. So put a web server on your own computer, and test away!

PHP, SSI and CGI are all easy to test on a Windows, MacOS X or Linux PC. First install the web server of your choice, usually either Microsoft Internet Information Server (for Windows XP Professional and all Windows Server operating systems) or Apache (for just about every system there is). Then configure it exactly as you would configure a web server running on a real web host. To test PHP, you'll need to install PHP on your server (MacOS X and Linux users may already have both Apache and PHP installed).

OK, yes, there are ways to run ASP on Apache. But some of these are complex and still experimental, like MONO. And the rest are expensive. So we don't recommend them for testing at home. If you really need to test ASP pages at home, we suggest using a computer with Windows XP Professional for that purpose. Of course, you won't have to worry about this if you choose PHP instead.
Windows XP Home users, and users of older versions of Windows (95, 98 and Me), will need to install Apache as Microsoft IIS is not available for these systems. Those who want to test ASP pages must have Microsoft IIS. access it to test your pages? Simple! Just access this URL: http://localhost/

What's going on here? localhost is a special name that always means this computer in front of me that I'm typing on. When you connect to localhost, you're not going out to the Internet, you're talking to your own computer. Most modern PCs are smart enough not to dial out to the Internet just because you are talking to your own computer.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!