PHP 5.2 or 5.3?


#1

How do I know which PHP version to use? Why are there even options and which is best?


#2

Go with 5.3 unless you have a good reason not to. Some functions were deprecated in 5.3 which broke some applications, so unless you have some errors in your app when using 5.3, you can avoid 5.2. Usually later versions are better.


#3

I’ve recently upgraded from 5.2 to 5.3 on DreamHost. One big thing to be aware of is that there is no XCache at the moment on 5.3.


#4

That’s what I was wondering too - whether to upgrade or go with the default. So… why does Dreamhost set 5.2 as default then? And what about CGI vs FastCGI. It always seems like you’d want the latest version, and something with the word “fast” in it seems even better. … so why is the default for one step down at 5.2? What reason would I have to stay at 5.2?

Also - if I have a couple of Wordpress sites, will changing to 5.3 FastCGI screw anything up? One site is several years old, but I’ve been upgrading all along as the new WP upgrades come out.


#5

There is, unfortunately, a surprising amount of software that will start throwing error messages or stop working entirely under PHP 5.3. I believe that most, if not all, of our One-Click Installs are fine under 5.3, but some third-party applications may run into problems (typically just unexpected error messages).


#6

I’m not an expert on PHP, but there were a few things such as closure which became available in 5.3 that makes programming much easier, so some apps simply won’t run on 5.2. But then there are older apps which rely on some features that were deprecated or dropped from 5.2 in 5.3.

As for FastCGI, I think it depends on the nature of your site and the load patterns per visit. I found that FastCGI actually made my site slower overall. If I understand it correctly, it’s because the vast majority of requests are for a single 1k bit of HTML which is returned through an AJAX request. FastCGI seems to improve site performance when there are a lot of requests at the same time. Actually, I shouldn’t say that. I don’t really fully understand FastCGI, but I did benchmark regular and FastCGI under ridiculously high loads and found that regular resulted in fewer errors from running out of meory and faster overall load times for my particular situation. I doubt, however, that most sites have a usage pattern which consists of users sending 30-50 AJAX requests for every ‘normal’ page load.


#7

Older versions of Mambo, a content management product that hasn’t had any serious updates lately may throw up some error messages in PHP 5.3. That’s a key reason why we had to revert on that particular colleague’s site. Unless your script needs the newer PHP, it shouldn’t be an issue. Performance isn’t going to be all that different in my experience.


#8

Ok thank-you so much everyone! And if anyone has anything else to say about this - please feel free to add.


#9

Uhh… so just to verify… if I have 2 Wordpress, one-click installs, and I upgrade to PHP 5.3 Fast CGI - I shouldn’t have any problems right?


#10

WordPress and any recent set of plugins should work fine. But if you are using some really old plugins, you might see some problems. Regardless you should always true to use the very latest WP to take advantage of new features and, even more important, security updates.