PHP Update: Five, finally: fast and flexible!

As many of our members know, we’ve been beta-testing PHP 5 for a really long time. The PHP 5 Beta is now over; PHP 5 has become the default for new sites created on our service.

This represents the culmination of a mountain of work on our part; in order to make PHP 5 work for you, we’ve had to retool the backend of our clustering technology to support heterogenous software environments. That’s going to have all kinds of cool benefits in upcoming days, well beyond its implications for PHP.

If you’re currently running PHP 4 and you’re happy with it, don’t worry. We’re not planning to do anything drastic to you at this time, and we’ll continue to support PHP 4 as long as the developers do.

As part of the PHP 5 beta, we’ve also unified the versions of PHP 4 and PHP 5 that appear in the ssh environment, and we’ve updated the environment to detect which version your site uses and put it first in your default PATH variable. Concurrent with the update, the /usr/local/bin/php link has been switched from PHP 4 to PHP 5, but since the “php” you get when you type “php” will come straight from the version-specific directory appropriate for your site, that shouldn’t have much effect.

In case you haven’t been following the long-running PHP 5 Beta forum thread, you may not be aware that you can switch back and forth between server types on the fly, usually without downtime. (It’s remotely possible that someone else could trigger a second update right after you, which would cause your site to display “Unknown Site” for a minute or so after switching from PHP 4 to PHP 5 or vice-versa.) To switch PHP versions, all you have to do is click “Change Server Type” on the Site Information panel for your site in our member interface, select the radio button for the site type you want, click “Save Changes,” and wait around for a minute or so.

But, hmm, what’s this? There seem to be two PHP 5 server types listed on that page… “PHP 5 Fast” and “PHP 5 Flex (Beta).” What’s that all about?

Well, we just loved having PHP 5 in beta so much that we couldn’t let it go! OK, not really. Have a look at PHP 5 Flex phpinfo() output compared to PHP 5 Fast phpinfo() output. Spot any important differences?

PHP 5 Flex is a new implementation of PHP that runs inside our customized CGI environment. This means we can do fun stuff like turn off safe_mode and open_basedir. That’s right: you can now get non-safe_mode PHP at NearlyFreeSpeech.NET. Now, this has always been sort-of possible if you were willing to mess around with .htaccess, make all your PHP scripts executable and hack #!/usr/local/bin/php lines into them at the top, but when you do that, you’re running the command line version of PHP, so weird stuff sometimes happens. PHP 5 Flex, on the other hand, runs the specialized CGI version of PHP based on the same configuration we used for standard PHP 5, and it runs standard .php files unmodified. You don’t even need to make the PHP scripts executable; it just works. It also uses all the same /home-based paths you’re familiar with from the ssh command line and CGI, like /home/public.

So why would you ever not want that? Well, the answer lies in the name of the alternative, PHP 5 Fast. PHP 5 Fast is based on mod_php5, which runs significantly faster than CGI-based PHP: often three to five times faster, especially when handling lots of small requests. If you don’t need safe_mode off to get compatibility with some strange third-party application, there’s no need to take the speed hit associated with virtualizing every request. That’s why the new PHP default is PHP 5 Fast and why we recommend leaving it as-is unless you have a good reason to change it. PHP 5 Flex is also beta; there may be a few problems to kick around. If you try it and find them, let us know via the forums or support requests.

So that’s our big PHP 5 update. It’s been a long time coming and a lot of work; we hope you enjoy it!

9 Comments

RSS feed for comments on this post.

  1. Haha, sweet! Though I likely won’t be using Flex, it’s cool to have a virtualized environment available.

    Comment by Tim McCormack — December 27, 2007 #

  2. Damn you guys kick ass. Keep up the good work!

    Comment by [name withheld] — December 27, 2007 #

  3. NFSN has been a blessing over the years. Really great decisions lately — thanks for keeping us informed!

    Comment by PC — December 30, 2007 #

  4. Wow, great job guys. You are, by far, the best hosting company I have ever dealt with. You guys are on top of things and know exactly what us developers want. Thanks so very much!

    Comment by Brett — January 2, 2008 #

  5. thank you so much NFS-Team for your hard work!

    Comment by arT2 — January 4, 2008 #

  6. […] However, testing is complete, and PHP 5 (v5.2) support is now out of beta and is the default for all new sites. I just set up a new site not knowing this and everything in my PHP app is functioning as I’d expect. Groovy! […]

    Pingback by PHP 5 now out of beta at Nearly Free Speech » Matt Shelton — January 4, 2008 #

  7. It’s not everyday I read an article in which people are excited about PHP technology… but I would like to; it’s really incredible stuff.

    Keep up the good work guys!

    Comment by Determination — January 14, 2008 #

  8. Great! Now update the FAQ where it says you don’t have PHP5.

    Done. Thanks! -jdw

    Comment by George Smith — January 16, 2008 #

  9. That’s really cool that you are switching to PHP5. I might just have to switch to NFS!

    Comment by Mike — January 20, 2008 #

Sorry, the comment form is closed at this time.

Entries Feed and comments Feed feeds. Valid XHTML and CSS.
Powered by WordPress. Hosted by NearlyFreeSpeech.NET.

NFSN