Can PHP Be Used For Prime Time Websites?

[Category: Reviews]

This is an interesting question and one that my answer has recently significantly changed direction by approximately 180 degrees. There was a number of reasons why I never believed that PHP was a particularly good choice of language for building web ‘applications’.

Firstly, my chosen career suggests that I ought to be using Java J2EE for developing web applications. But Java J2EE makes things quite complicated, sometimes over complicated. It’s very flexible of course, but it’s heavy on resources (needs oodles of memory!) and heavy on development time, heavy on deployment time.

Then there’s ASP.Net, which I’m really very enamoured with, and still to this day really like. Except it only runs well on a Windows platform (don’t get me started on trying to setup Mono in a web environment! The instructions aren’t clear, generally don’t match reality and when you’re faced with ‘sigsegv’ or ‘libc does not support TLS’ even though you’ve installed the RedHat 9 RPM’s onto a stock Redhat 9 system you get a bit downhearted). Where was I? Ah yes, ASP.Net is a great choice for large web applications. But it can be expensive to keep up with, because the latest and greatest features are added to the latest and greatest IDE. The constant upgrade treadmill for the development environment becomes tedious and costs a lot of money.

Which brings me to PHP. In particular, PHP with the Smarty Template Engine and VS.PHP. In my opinion it provides most of the flexibility of J2EE and ASP.Net without the upgrade treadmill costs, or the complex web.xml deployment descriptors. Admittedly, using VS.PHP does require a copy of Visual Studio.Net, but it works just as well on VS.Net 2002 as it does on VS.Net 2003. I can only assume at this point that it’ll continue to work VS.Net 2002 for the foreseeable future, and I’ll be petitioning the authors accordingly since that’s the version I have.

Using Smarty for web development really brings PHP into the prime time. It provides business logic from display logic seperation which has long been lacking in PHP. Not that it forces you to – you do have to be disciplined about it, but then the same is true of both JSP and ASPX. You seperate out your templates from your PHP classes, and use simple template variable substitutions for including dynamic data. The whole development cycle is very rapid, from design, to deployment with the VS.PHP FTP deployment tool. Page execution is extremely fast, particularly if the programmer makes efficient use of the very easy to understand Smarty caching mechanism. The caching mechanism of Smarty is very easy to setup, very easy to program for, and provides some significant performance gains for your pages. It’s significantly easier to program for than the ASPX caching mechanism.

If you’re looking for speed of development, speed of deployment and speed of execution, you’d be hard pushed to find a better alternative than PHP Smarty and the VS.PHP product. I’ve only really just touched on the very edge of this subject – I suspect I will update this with some more meaningful comparisons later.

Leave a comment

Your email address will not be published. Required fields are marked *