CSCI 431: PHP
Introduction
PHP (officially "PHP: Hypertext Preprocessor") is a server-side
HTML-embedded scripting language. It is used to create dynamic web
pages. Moreover, PHP code was developed for embedment within HTML. In
doing so, it was hoped that benefits such as quicker response time,
improved security, and transparency to the end user would be achieved.
Much of PHP3.0 is a combination of Perl, Java, and C concepts. The
syntax structure borrows heavily from C.
History
PHP was conceived sometime in the fall of 1994 by Rasmus
Lerdorf.
- Early non-released versions were used on his home page to
keep track of who was looking at his online resume. The first version
used by others was available sometime in early 1995 and was known as
the Personal Home Page Tools.
- The parser was rewritten in
mid-1995 and named PHP/FI Version 2. The FI came from another package
Rasmus had written which interpreted html form data. He combined the
Personal Home Page tools scripts with the Form Interpreter and added
mSQL support and PHP/FI was born.
- PHP/FI grew at an amazing pace and
people started contributing code to it.
- By mid-1997 this number had grown to over 50,000. Mid-1997 also
saw a change in the development of PHP. It changed from being Rasmus'
own pet project that a handful of people had contributed to, to being
a much more organized team effort. A lot of the utility code from PHP/FI was
ported over to PHP 3 and a lot of it was completely rewritten.
- Today (10/2000) PHP 3 or PHP 4 now ships with a number of commercial
products such as C2's StrongHold web server and RedHat Linux. A
conservative estimate based on an extrapolation from numbers provided
by NetCraft (see also Netcraft Web Server Survey) would be that PHP is
in use on over 3,300,000 sites around the world.
A Short List of Features
- PHP can be used to create and modify GIF, JPEG and PNG images on
the fly, and display them in your browser.
- PHP4 supports classes and OO techniques.
- PHP4 comes with a bunch of new functions designed to allow FTP
connections over the Web.
- Makes working with cookies easy, e.g., to create and modify a
cookie, use the PHP function setcookie().
- Many built-in functions and variables as well as integration with
various external libraries that let you do everything from generating
PDF documents to parsing XML.
- One of the most compelling things PHP has going for it is it
support for a wide variety of databases. It supports many of the most
popular database servers on the market, including MySQL, Oracle,
Sybase, mSQL, Generic ODBC, and PostgreSQL, to name a few.
- PHP makes session management, an important component of
transaction-based Web sites, easy (or so they say).
- Supports the use of regular expressions for text processing.
Class Demonstration
PHP Examples by Roger Whitney
Other Useful Links
- The definitive guide to PHP is the
PHP Manual -- also
available: a "lower-tech" HTML3.2 version
here.
- Here's a good
introduction to PHP.
- I really like
this PHP
tutorial -- perhaps it's the author's conversational writing
style, but he/she also explains lots of stuff very clearly.
- PHP is built "on top of" the Zend
Engine in its current release.
- Here's an interesting
article
on why PHP is better than Perl. He makes a good case.