PHP4 to 5 upgrades
April 26, 2007
I’ve got a few servers I’m upgrading to PHP5. I’m probably one of the last people to make this upgrade. I’ve worked at a place where PHP5 was used, so I was comfortable with it, but the servers I run for myself and my current workplace were both PHP4.3. Recently, I’ve upgraded my personal servers (consolidated to one) and made the upgrade to PHP5. Currently it’s 5.0 - I need to find FC4 RPMs for 5.1 or php 5.2. (Pointers gladly accepted)
We’re moving towards PHP5 at work - some of the smaller utility systems that are being written are being done in PHP5 (5.1 I think). However, we’ve got problems upgrading older stuff, and I have personally as well. Probably the biggest killer is XML - I’ve got a few sites that use the PHP4 DOM stuff, and it’s completely not working in 5 - I need to rewrite those portions. I’d read a few comments from people over the years about “if you were dumb enough to use XML in PHP4 you deserve what you get” or something equally ridiculous. I used DOMXML in PHP4 because it fit the job, and the PHP5 designers thought that new functionality under the hood was better than keeping backwards compatibility. Tough choice, I know, but still painful.
I’m wondering if it’s worth it to look for (or write) an XML interface to avoid or mitigate these sorts of issues in the future. I’ve not written direct db calls in years, but for dealing with XML I (and most people) still deal with raw XML functions/methods. Would it not be better to abstract those out as well to ‘future-proof’ XML functionality? Does anyone have such a thing?
Frankly, even after all this, I’m still not sold that PHP5 is *that* much better. There’s still fatal errors instead of exceptions, ‘requirements’ instead of ‘hints’ in method signatures, no ability to ‘hint/require’ primitives (string/int/float/etc), etc. I just don’t think there’s that much utility for the average developer in the ‘private/protected/public’ functionality offered, especially considering that even that behaviour changed between 5.1.6 and 5.2. A colleague was mentioning to me that the behaviour of private constructors in subclassed objects changed in 5.2, and was no longer allowed (or perhaps it was protected constructors? it’s been a couple months since he mentioned it).
To supplement my PHP experience, I’ve begun digging in to Groovy recently. I won’t repeat all of that post here, but it’s enough like PHP that the transition hasn’t been too hard so far, although I’ve not done much useful with it yet. I’ll keep you posted… ![]()
Posted in 



