From personal tool to a popular Apache module, it is now in version 4 beta.
by Craig Knudsen
If you've never heard of PHP, you're certainly not alone. However, you've probably visited one of the many sites driven by PHP, such as the widely popular Linux application portal Freshmeat.net.
PHP is a server-side HTML-embedded scripting language that allows developers to build web applications. PHP's features are comparable to Microsoft's ASP (Active Server Pages) and VBScript. Both PHP and ASP are interpreted scripting tools that allow HTML and code to be mixed in the same file. Both have effective APIs for building database-driven applications. However, unlike ASP, PHP is open source and cross-platform. PHP can run on Windows NT under Microsoft's IIS web server or on any UNIX variant as an Apache module or CGI.
PHP, which stands for ``Personal Home Page'', was originally developed by Rasmus Lerdorf as a macro tool for tracking visitors to his home page. It grew from its simple roots into a complete tool for building web applications by version 3. Released in June 1998, PHP version 3 (often referred to as ``PHP3''), was primarily developed by Andi Gutmans and Zeev Suraski.
Since then, PHP has continued to grow in popularity. It's not possible to determine exactly how many PHP-powered sites there are, but NetCraft's survey data suggest that over 500,000 web sites are running PHP. Additionally, E-Soft's Apache module survey shows over 100,000 PHP-enabled Apache servers. E-Soft anticipates PHP will become the leading add-on module for Apache, ahead of extensions for FrontPage and mod_perl.
Andi Gutmans and Zeev Suraski began working on version 4 in November 1998. Version 4 is a complete rewrite of PHP's scripting engine. Unlike PHP 3.0, the new ``Zend'' scripting engine bundled with PHP 4.0 is a separate product. Eventually, Zend will be used for other scripting applications. (Incidentally, the name ``Zend'' is derived from the the developers' names: Zeev and Andi.)
The most significant change in version 4 is a dramatic increase in speed. The Zend team posted preliminary benchmarks of PHP/Zend and ASP/VBScript. Due to the similarities in concept, ASP is considered PHP's greatest source of competition. The various test cases show PHP/Zend running significantly faster than ASP on identical hardware under Windows NT/SP4 and IIS.
Performance was not the only design issue with Zend. Asked what other design goals he had for PHP/Zend, developer Zeev gave the following list:
PHP 4.0 includes a variety of new features. A command-line interactive debugger will be included that supports break points and stepping through scripts. The debugger has not yet been released as of PHP 4.0 Beta 2.
Support for Windows COM objects has also been added, giving developers access to the wide variety of available Windows server components.
Because of the new automatic resource deallocation, resources don't need to be freed within the script, since they are freed as soon as they are deallocated. This is similar to Java's garbage collection. Note that PHP 3.0 will also free resources automatically, but not until after the script is finished processing.
New syntax changes include support for a foreach loop. Additionally, the terms ``true'' and ``false'' are now predefined. Pointers can now be implemented allowing two variables to represent the same variable.
New output buffering allows developers to abort a page after processing has begun. This simplifies proper error handling in scripts.
In March of this year, a closed beta was released to PHP developers and a handful of other sponsors. The first public beta of PHP 4.0 was released in July, followed by Beta 2 in August.
Feedback from the first beta release was very positive. The official word from Zeev Suraski on the release date for 4.0: ``We'll release PHP 4.0 once it is stable enough for users.'' The remaining work is checking all the PHP modules to make sure they're PHP 4.0-compatible. After this is complete, PHP 4.0 should be ready for release. Most likely, this will be before the end of the year.
Craig Knudsen (cknudsen@radix.net) lives in Fairfax, VA and telecommutes full-time as a web engineer for ePresence, Inc. of Red Bank, NJ. When he's not working, he and his wife Kim relax with their two Yorkies, Buster and Baloo.