Intranet Design Magazine: PHP From an IT Manager's PerspectiveJun 04, 2000, 15:47 (0 Talkback[s])
(Other stories by Tobias Ratschiller)
By Tobias Ratschiller, Intranet Design Magazine
1. Introduction to PHP
What have sprint.ca, livebid.amazon.com, xoom.com, and mp3.lycos.com in common? All employ one of the Web's hottest server side technologies: PHP, the PHP Hypertext Preprocessor.
While the success of Open Source software like Linux or Apache has been documented extensively throughout all mainstream media, the rise of PHP has gone largely unnoticed. Still, the Web scripting language PHP is the most popular module for the Apache Web server, according to a E-Soft survey (http://www.e-softinc.com/survey/). Netcraft studies have found that PHP is in use on over 6% of all Web domains in the world (see http://www.netcraft.com/survey). That is an incredible market penetration for a rather specialized product. This popularity continues to rise exponentially, with the new version 4.0 just around the corner. Increasingly, this is being reflected in traditional media: By May 2000, more than 20 books about PHP have been published in different languages, with more in the pipeline. Commercial players are beginning to join the bandwagon: PHP is included with Web servers, for example C2's Stronghold, and Linux distributions. A new company, Zend Technologies, has been formed to provide commercial add-ons and support for PHP. A long list of large-scale Web sites employ PHP, as well as hundreds of thousands small to medium Web sites. Enough reasons to take a closer look at PHP.
What Is PHP
Traditionally, developers have used CGI (Common Gateway Interface) scripts for interaction with users, querying databases, and so forth. However, because CGI scripts are separate software programs, which get executed as stand-alone processes whenever a user requests the script, scalability was lacking - CGI scripts could quickly consume all available memory and CPU power. Enter PHP: Rasmus Lerdorf, a then Toronto-based IT-consultant, developed it in late 1994 as a quick hack to embed macros into HTML pages, to avoid the forking of external programs. When he decided to make his project open source, it proved to be popular, and users started to contribute to it. In 1997, Zeev Suraski and Andi Gutmans, two developers from Israel, rewrote the core engine of PHP, the language parser, and made a complete programming language out of a pet project. The current rewrite, PHP 4.0, is again much cleaner, especially with complex scripts and when used in business environments.
PHP scripts are often embedded in the HTML code of page, and then get parsed on the server-side - the browser sees plain HTML only. A typical Hello-World script looks like this:
<html> <? print("Hello World!");?> </html>This is the method that novice developers find the easiest to work with. Larger and more complex applications usually go other routes, to enforce a cleaner separation of layout and application logic. When embedding the script directly in HTML, average, HTML-literate Web designers cannot easily edit the contents of the page without being familiar with the scripting language used. PHP offers a variety of libraries to work with page templates, which solve this problem, and introduce an efficient development methodology and simplify maintenance. This way, developers focus on the application logic, and designers can change the layout of a dynamic page without involving the developer or interfering with the program logic. This translates into faster application development, and makes maintenance tasks easier by dividing them into content and logic tasks, which can be handled by separate team members.
PHP needs not be used for Web development exclusively. It can also be compiled as stand-alone script interpreter, and handles simple system administration tasks as well. For example, you could use a small PHP script to send daily statistics from your e-commerce application. In version 4.0, the language core engine, the Zend parser, has been abstracted enough to be embeddable in other technologies. Rumors go that is planned to integrate PHP as stored procedure language into the popular MySQL database system. Seeing the dynamic evolution of PHP, it is only logical to expect the language to grow into other scenarios - why not use PHP as a macro processor in a word processor?
2. PHP Meets Development Challenges
The first advantage of PHP was one common to many Open Source projects: It simply delivered, while other technologies were still vapor ware. PHP pre-dates ASP, Mod_Perl, and ColdFusion by at least 12 months. Over the years, PHP had the opportunity to strengthen its core base and to integrate more features, and provides today a base that can easily stand out in the increasingly crowded server-side application development platform market, as the following points will show.
Faster Time to Market
Perl is a general scripting language, Java is a full-fledged, complex programming language, Visual Basic Script and JSscript have been post-integrated into ASP - PHP, on the other hand, was built with the needs of Web developers in mind. In Web application development, there is no itch you can't scratch with PHP. Unlike other cumbersome, overhead-laden approaches, PHP is lightweight and focused on the Web - where it can solve complex problem scenarios quicker and more easily than comparable technologies.
The syntax and grammatical structure of PHP resembles the C programming language with the complexity (for example, memory management, pointers, and strong typing) taken out. The developers of PHP aren't hesitant to integrate the best features of other languages, though, so you'll find elements of Perl and Java in PHP as well. For programmers familiar with C, Perl, or Java, it is a matter of days to get acquainted with PHP. Thanks to the excellent reference manual, anyone of your developers can probably produce small database enabled applications after just one afternoon.
Besides databases, PHP supports most current Internet standards: IMAP, FTP, POP, XML, WDDX, LDAP, NIS, and SNMP - to list only a few of the acronyms which will inevitably get a twinkle into your developers eyes. For corporate and IT needs, this simply means that PHP is able to talk to different standards and technologies with ease: All from one common tool set, without the need for expensive third party modules.
Leveraging Enterprise Logic
Portability is the key to scalable applications. You can run the same application on a low-scale Linux box and on a high-end Solaris machine, without the need to worry about platform-specific features. Also, PHP interfaces transparently with clustering solutions from simple Round Robin IP clusters to advanced Cisco solutions.
The broad platform support can be directly attributed to the fact that PHP is distributed with full source code. Anyone with the necessary skills can port PHP to a new operating system. The resulting modifications to the core system can then be contributed back to the community.
Then there's the community. Free help is available from mailing lists, newsgroups, and IRC channels. The PHP core developers participate in these support forums, and provide developers with top-level advice - usually within hours. I'm certain that more, commercial support options will be available in a very short time.
Open Source brings with it that rough edges are corrected promptly, and that the overall strategy is un-bureaucratically adjusted to new requirements. For example, originally no one had thought that PHP would be used in most sophisticated business scenarios, and only version 4.0 is really prepared for this environment.
Zend Homepage: http://www.zend.com
0 Talkback[s] (click to add your comment)