Creating Webpages with PHP
By Stephen Bucaro
Introduction to PHP
The initial Web consisted of static HTML webpages. In other words, every time you
accessed a webpage, it would look exactly the same. It was quickly realized that
some means was needed to make webpages more dynamic. At first a programming interface
called CGI (Common Gateway Interface) was used. CGI was mainly used with Web forms
to acquire data from a user.
CGI has a very difficult to understand language and therefore a pain in the butt
to use, but some Web programmers were doing amazing things with it. Then in 1994 the
Danish programmer Rasmus Lerdorf created the PHP language. It initially started
out as some "Personal Home Page" scripts he used to maintain his personal homepage.
Today's PHP is a powerful easy-to-use server-side scripting language that is used
to create dynamic webpages. Some people who, when using PHP want to pretend to be
doing something complicated claim that PHP stands for "PHP Hypertext Preprocessor".
First of all "PHP Hypertext Preprocessor" doesn't make sense, and secondly PHP
doesn't really "process" hypertext.
PHP is free software based on the GNU General Public License (GPL), but not exactly
because if you derive a different language from PHP, you're not allowed to call that
language "PHP", so we can just say PHP is free under the "PHP License". Since PHP is
free to the Public, and it runs on the server (Host) and it's a Programming language
- I submit PHP stands for "Public Host Programming" language.
Some languages have to be "compiled" before you can execute them. To compile basically
means to convert to machine code. PHP is a "scripted" language. A scripted language
uses an "interpreter" to convert it to machine code on the fly. It's not compiled.
Each time the code is executed it's interpreted line-by-line character-by-character.
Microsoft makes a server-side scripting language called ASP (Active Server pages).
Actually, ASP is more properly a "scripting engine" because it can run several
different languages, like VBScript, C sharp, and JScript. Microsoft's latest
incarnation of ASP is called ASP.NET, and it has the advantage of being able to
pre-compile some code, which makes ASP.NET applications run faster.
In general if you have a Windows Web server, you'll use ASP or ASP.NET, but ASP
can also run PHP. In general if you have an Apache Web server, you'll use PHP,
but there are versions of ASP that run on Apache, like Chili!Soft ASP, which was
acquired by Sun Microsystems and became Sun ONE ASP, and Sun Microsystems was
acquired by Oracle. But here we're concerned with PHP.
To learn PHP, you'll need a Web server. If you're using a Windows PC, you can go to:
PHP on Windows
were you can run the Microsoft Web Platform Installer to get PHP up and running on
Windows and IIS. There you'll also find lots of information about running PHP on Windows.
If you're using a Linux PC, you can install Apache Web server. PHP was originally
designed for Apache so you may find PHP already installed with Apache. You can
also install Apache for Windows. Or you can use an application called Server2Go,
which is an Apache⁄PHP simulator that you can run from a flash key, or a folder
on Windows without installing anything.
For the examples in this article, you'll use a basic text editor, like Windows
Notepad to create your files, then copy them to your Web server folder. If you're
using an Internet Web Host, you'll need to upload your files to the server with FTP.
You can then access your files using the Web site's domain name plus your file name.
If you're using a Web server on your local PC, you'll access it using localhost
and your filename. If you're using Server2Go, you'll access it by the IP address
provided by Server2Go and your filename.