Friday, August 15, 2008

PHP

So, for the past few days at work I've been self-tasked (anything to avoid doing more QA work) with researching and testing possible upgrade avenues for our internal bulletin board- a simple phpbb instance.

While the version we have installed is very stable, it lacks one critical feature that myself and the important folks inside the Sys Admin group consider very helpful: LDAP-based authentication.

Fortunately, the newest version of phpbb includes LDAP authentication built-in, so once one has an instance running, one merely has to literally click a button and type in the distinguished name and LDAP server information, and one is ready to go.

I duplicated the message board database to my computer with little trouble; mysqldump is one of those simple, disproportionately useful utilities that you would have written yourself had you not known it already exists. Anyways, step one went very well.

Step two: PHP configure/build/install. Wow. Does it need to be that hard? I mean really, I shouldn't have to rebuild PHP every time I want to add new functionality. Running this:

./configure --with-apxs2=/usr/sbin/apxs --enable-xml \
--with-mysql=/usr/local/lib/mysql
make
sudo make install


and adding a new --enable-foo or --with-bar=baz every time I want to add a new module is simply ridiculous. Does this have something to do with PHP's lack of any concept of namespaces? I mean, really, do we need to throw all 3000+ possible functions in the global namespace? This isn't C, guys. Things would be somewhat alleviated if there were any sort of uniform naming convention that the PHP standard library followed. Unfortunately, no such convention exists and if it does, it is religiously not implemented. WTF?

Anyways, I finally got phpbb3 up and running. It is a testament to the phpbb team that they are capable of writing what I have, in my very limited experience, deemed to be a very well designed piece of software in such a bizarre language.

I guess I should mention that I'm a python guy. Before that, I was a C guy. I've looked into Ruby, which seems like a cool language but provides no functionality I feel I need that python doesn't provide (and it's syntax is very foreign, but I guess that's not really a criticism. If I had my druthers...). I learned Perl before Python, and never really appreciated it. I find that the general rule with Perl is that it's great for one-off one-liners; anything including more than one carriage-return would probably better be served by a more readable language, like assembly.

It seems to me that PHPs most praised feature is also its greatest weakness: anybody can write a web application in PHP. Perhaps I'm an elitist (difficult to prove, I have very little formal CS/SE education), but I've found that people should cut their teeth on well-structured language-- a category in which I include python, C and (grudgingly) Java-- so that they learn good form before being thrown into a syntactic free-for-all with languages like PHP or Perl.

I do have some good things to say about PHP: it's very readable, when not written by a 14-year-old geek setting up his first message board; the community is abundant (though that can also be a problem), and it runs on anything, which for a dynamic-content language is huge; Python has its own web frameworks (I'm finding appreciation for Django), but it is simply not as widely utilized as PHP. That whole language-itself-as-a-templating-system is pretty cool.

Anyways, I guess it just comes down to personal preference. I just can't seem to get into PHP, no matter how hard I try; it stirs up something inside me, something that can only be calmed by using a language that was actually designed. Wow, that sounds really flamebait-y. Sorry. If I wanted to cause trouble, I'd tell you why Emacs sucks and Vim über-alles ist!

No comments: