From home pages to popularity
This week we take a break from TCP/IP ports and sashay back into the realm of languages. Our target is PHP, a language that has come a long way from its humble roots as a set of macros for building personal home pages on Web servers. Today, PHP is a server-side scripting language that is officially called PHP: HyperText Preprocessor.
PHP is an amalgam of several languages - much of its syntax is borrowed from C, C++, Java and Perl. What's so great about PHP? Well, the fact that it's free helps (www.php.net), but there's more: PHP is open source; runs under Win32, Macintosh, Unix and Linux with all leading Web servers; it's easy to learn and use; and the latest version, PHP4, runs as fast as Microsoft's Active Server Pages technology.
PHP4 has become wildly popular and is now a major language in Web scripting. According to the October 2000 NetCraft Web survey, PHP was running in more than 3.8 million domains on 715,283 IP addresses (also see here).
PHP4 has powerful extensions for services such as XML, Lightweight Directory Access Protocol and Internet Message Access Protocol and includes direct access for a large number of database products, including Oracle and Informix.
PHP works like many other Web scripting languages - Web pages requested by a browser that contain embedded PHP scripts are parsed on the fly by the PHP interpreter on the server, and the modified page, stripped of the PHP code, is sent to the browser.
The interpreter for the PHP language is the Zend Engine. Created by Zend Technologies, it is licensed to users for free and is also open source. Zend Technologies also recently released a free code optimizer (), which it claims doubles the speed of PHP scripts.
The Zend Engine reads PHP scripts, compiles them and executes the compiled code. Zend Technologies will soon offer a product called Zend Cache, an enhancement to the Zend Engine that capitalizes on the read-compile-execute model by caching an "intermediate" code version of the script to reduce compile time for future executions and to reduce server loading. Pricing is not yet available.
You might want to create commercial products using PHP. Zend Technologies will soon release something called the Zend Encoder (pricing is also not yet available) that encrypts a PHP script by turning it into intermediate code so your algorithmic sleights of hand can be kept private. To run the resulting application you will need the free Zend Loader, which will be invoked whenever an encoded script is run to pass the intermediate code to the Zend Engine.
Next week, we'll take a look at the PHP language. But before we take our leave, we'll mention an interesting news item: The first PHP scripting virus, called PHP.NewWorld, has just been found.
The virus has no payload and seems to only affect Windows systems. And it can't infect other computers; it only infects files of the types .php, .hm, .html or .htt in the c:\windows subdirectory. This virus is easily detected and countered but it illustrates an interesting potential problem for all scripting languages - not just for PHP.
Until next week, speak in tongues to gearhead@gibbs.com.
RELATED LINKS
Comments and suggestions to gh@gibbs.com.
Gibbs Forum
The place to discuss Gibbs's columns.
Check out this week's edition of
Backspin for more musings from Gibbs.
