Q&A: PHP creator Rasmus Lerdorf

Rasmus Lerdorf was the original creator of PHP, which has evolved from his personal home page project into an open-source scripting language used worldwide. Lerdorf was interviewed recently via e-mail by Computerworld online managing editor Sharon Machlis.

Q: What would you like corporate IT managers to know about PHP?

A:
PHP is not a major investment if they choose to use it. Obviously, being open source, there are no license fees to pay. But more importantly, the learning curve is extremely shallow and it draws on the skills the existing IT staff is likely to already have. PHP is not a new and revolutionary language. It borrows much of its syntax from languages such as C, Perl and Java.


Q: What are the major advantages of PHP? What is it best at?

A:
It is a very focused language. It focuses on the Web problem. If you read PHP's excellent online documentation, you will see everything is geared towards solving Web-related problems. It was written by Web developers for Web developers.


PHP is perfectly suited for quickly creating a Web front end to just about any back-end system you can imagine. Typically, the back end would be a database, but it can also be [a Lightweight Directory Access Protocol] directory server, or [Simple Network Management Protocol]-manageable devices, just to name a few. PHP is also good at generating non-HTML dynamic content for the Web such as images, flash or [Portable Document Format] documents. Being able to pull customer information from a database and dynamically generating a professional-looking PDF invoice, for example, is something that is very easy to do in PHP.


Rasmus Lerdorf, inventor of the PHP scripting language


Rasmus Lerdorf, inventor of the PHP scripting language











Q: What do you see as its drawbacks? What Web tasks do you think it's less well-suited for?

A:
There really aren't any drawbacks when it comes to Web tasks, but I guess that depends a little bit on where you draw the line between Web tasks and back-end tasks associated with the Web. PHP's strength is in the front-end Web interface. As you move more towards the back end, PHP usefulness starts to decrease. For example, you would never write a full back-end database engine in PHP. You also wouldn't write any sort of middle-layer system for a three-tier architecture in PHP.


As the top presentation layer in a three-tier architecture, PHP does just fine.


Q: What's interesting in the works for near-term PHP future developments?

A:
Deep in the guts of PHP, the object-oriented program [OOP] is going to be improved a bit. PHP has traditionally been a procedural language, and OOP features have crept in over the years to the point where PHP can be used as a decent OOP language. But there are some things that can be improved with respect to this OOP support.


Namespaces is another feature that is coming.


At the higher level, I think you can expect PEAR [PHP Extension and Application Repository] to start becoming much more useful. PEAR is a collection of userspace code for solving many Web-related problems that didn't belong in the core of the language itself.


You will also see some nice ways to build [Simple Object Access Protocol/Web Services Description Language] services with PHP. You can do this today, but I would like to see this become more transparent and am working towards that.


Q: Do you have any thoughts as to why someone should choose PHP over Microsoft's Active Service Pages (ASP)?

A:
This is a difficult question to answer without getting into philosophical issues. I will try to avoid those and just look at it from a practical perspective:


  • Windows 2000 Server: $3,999
  • Internet Security and Acceleration Server: $5,999 per CPU
  • SQL Server 2000 Enterprise Edition: $19,999 per CPU
  • MSDN Universal Subscription (w/ DevStudio): $2,799 per developer



    List prices from Microsoft.com


This can add up quickly. And you probably need to add some Internet connector licenses, maybe an Exchange server license if you are doing e-mail handling and perhaps the content management server, which is a whopping $42,999 per CPU.


Many will of course argue this point, but I can build you a similar setup using Linux, Apache+SSL, PHP, PostgreSQL and Squid. And there are a number of good open-source content management systems I can throw in as well. They don't all come in shrink-wrapped boxes with slick documentation, but the one thing they certainly do is work.


Set up a nice load-balanced architecture using Squid as a reverse proxy on the front end to a couple of Web servers on the back end with a separate database server. Toss in some database replication for load balancing and robustness. So perhaps five machines with two CPUs in each. The software alone could cost you over $300,000 for that, compared to $0. In this economy, this is significant.


Then there is the fact that managing an IIS [Microsoft Internet Information Server] server has been a nightmare this year. One security issue after another.


This doesn't mean that the alternatives don't have security issues every now and then, but at least you are not paying someone $300,000 on top of having to keep up with frequent security patches. For that kind of money, you should expect robust enterprise-strength software, which just works all the time. I don't mean to offend the Microsoft crowd out there, but that just hasn't been the case up to now.


Putting the whole Microsoft proprietary software vs. open source-debate aside, why should you pick PHP over ASP? In the end, they basically do the same things. Although some feel development environment is nicer for ASP than the various options for PHP, PHP has a lot of built-in functionality that you need to drop to COM [Component Object Model] to match in ASP, so from a development perspective it is probably a tossup.


If you are a devoted Microsoft shop and have developers who already know VBScript and the various other Microsoft technologies, you should probably choose ASP. If you are starting out fresh, you owe it to yourself and to your bean counters to take a long hard look at PHP and all the other great open-source alternative tools out there.


Q: I read an interesting debate when someone asked whether they should use Perl or PHP to develop interactive/dynamic Web content. Would you have any thoughts about the strengths of Perl vs. PHP?

A:
Perl is a general-purpose scripting language, whereas, as I said, PHP is a scripting language targeted at the Web problem. As such, there are a number of things built into PHP for accomplishing common Web tasks, where in Perl you need to either roll your own or go trolling through [Comprehensive Perl Archive Network] to find someone else's implementation.


I personally use a combination of PHP and Perl for many of my projects: Perl mostly for back-end tasks, while I have PHP doing all the front-end work. Of course, you could do the front end in Perl, but it would be a bit more work.


Q: Can you estimate how many sites are using PHP?

A:
Php.net/usage.php has some numbers. Basically, over 20% of the domains that answer on port 80 indicate that they have PHP installed. Whether or not they actually use PHP is difficult to determine.


Obviously, most of the open-source related sites out there use PHP. I know it is also used to some extent at MCI/Worldcom, Honda, Lycos and Amazon. Basically just count when you browse around. One in every five clicks is likely to be a PHP-powered site.


Q: I know PHP was an outgrowth of some code you wrote for your own home page. What were those original scripts designed to do?

A:
It started out as a library of C code I had put together from countless CGI programs I had written in C. I got tired of rewriting the same code over and over again, and also wanted to separate my business logic from my HTML layout.


So I wrote a very simple tag parser that would parse through an HTML file looking for special markup tags and replace those special tags with the result of my business logic code written in C. I put together a number of general-purpose tools useful on home pages that made use of this framework.


These tools implemented a simple guest book, did hit analysis, tracked number of visitors and a couple of other things. They were intended to be examples of how to use this framework I had built that made it easy to add business logic written in C to a Web server and make calls into this business logic from within an HTML page.


Q: What, if anything, does PHP stand for?
A:
The initial release back in 1995 was called the Personal Home Page Tools. Over the years, PHP has outgrown the notion of being a set of tools for home pages, so it was felt that we needed a better name. After much debate and a vote, the rather lame "PHP: Hypertext Preprocessor" name was picked. We tend to just say PHP, though, the same way very few people expand out the Perl acronym.


Q: Did you have any intention for those scripts to turn into an open-source project? If not, how did it happen?

A:
No, I had no intention of creating a huge open-source project or even a scripting language. I wrote the initial tools because I felt I needed something like them and I couldn't find anything out there that approached the Web problem the way I wanted to approach it.


People ran across my home page and other sites I had worked on and asked how I had done various things. Having learned to program from looking at other people's code, it never even entered my mind that I shouldn't let people download and use mine.


Q: What does that feel like, to create something that becomes an international Web standard language, when you see your creation on thousands of Web sites all over the world?

A:
That part of it has worn off long ago. What I like is when I get out in front of user groups in various countries and meet the real people face to face, where PHP has made a difference to them personally. This is especially true in some of the poorer countries of the world, where not just PHP but all open-source technologies have enabled them to participate in the global community on par with the rest of the world.














Copyright © 2002 IDG Communications, Inc.

Bing’s AI chatbot came to work for me. I had to fire it.
Shop Tech Products at Amazon