April 5, 2007

Why I dislike PHP

Filed under: PHP — Gyrbo @ 3:50 am

Lately, it’s been quite easy to spot that I’m starting to dislike PHP. Over the years I’ve worked with several different languages and all of them have their downsides. These usually pop up when you’re doing some advanced stuff or doing things the language wasn’t made for. It may be that these little annoyances are becoming evident because I’ve been using PHP the longest. Here’s good summary problems I ran into while trying to update the web-cp modules/hooks system: http://keithdevens.com/weblog/archive/2003/Aug/13/HATE-PHP
His last point has since been resolved, though.
Other little things that both me are the inconsistencies in the standard library: http://tnx.nl/php (just ignore the pro-Perl talk).
In addition, there’s the extensibility (or better, lack thereof). Good steps have been taken with PEAR, but it still isn’t (IMHO) up to par with other languages like Perl (CPAN), Java (myriad of extensions, etc.), Python (extensive standard library and plenty of extensions), …
My main gripe is that you can never be sure the user has an extension that you require. With Web-cp, we are in a privileged situation since it’s easy to add certain extension to the requirements. Few projects have that luxury. This is of course not about PHP-only extension (such as those in PEAR). The problem with those is that they’re often quite slow.
Finally, there’s that little voice in the back of my head that’s worried about security. The PHP developers have show a distinct lack of interest in pretty much anything security related: http://www.php-security.org/ Some of those bugs are dangerously old. This should be a major concern to us as web-cp developers since we’re running PHP as root!

To finish off, I don’t believe PHP is completely useless and I certainly won’t stop working on web-cp because of it. It’s just that if I would start over, I would probably use a different language. Which one that would be is still in the middle, though.

My next blog post will most likely be about how I envision web-cp in the (far) future. Things like Object-Relational Mapping and a data-driven interface come to mind. And yes, it will probably still be in PHP ;-) .