PHP prediction

September 6th, 2007 by mgkimsal Leave a reply »

I’m publicly predicting here that someone will write a PHP patch that allows PHP4 and PHP5 to peacefully coexist in the same Apache server without the need for proxying and such ugliness.  Given the high number of shared hosts still running PHP4, the backwards compatibility issues going from 4->5 (yes, there are some!) and the new PHP4 “end of life” date (8/8/8), someone will likely find a way to make these run together, and possibly even charge money for it.

Many hosts would likely gladly pay a small fee for a patch to have 4 and 5 co-exist (.php = php4, .php5 = php5) as a way to help clients migrate without having to do a hard upgrade.  Hard upgrades introduce loads of broken sites, unhappy clients and other badness no one wants.  If a patch like this was free and/or open source, that’d be great, but I suspect that it would have been done already if people in the ‘free’ world had that itch to scratch.  As it stands, there are thousands of hosts hosting millions of domains that don’t have a simply upgrade path.

Much of the PHP developer community has seemed anxious for people to upgrade to people for a long time, yet haven’t produced the technological means for people to seamlessly upgrade.  Instead, they invariably fall back to “it’s not that hard” or “there aren’t any issues” or “the issues are all minor”.  The scope of the matters isn’t really at issue – the fact that there are any issues at all is reason enough for people to stay on 4.  With the new 8/8/8 deadline, the PHP dev community is saying “enough is enough, upgrade already”.  That’s fine for what it’s worth, but still isn’t really a solution most hosts can easily live with.

So my prediction is that there will be a tool for 4/5 coexistence in the standard LAMP hosting environments before August 8, 2008.  Whether it will be free or commercial, I don’t know.

Share and Enjoy:
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati
Advertisement

11 comments

  1. jstubbs says:

    Gentoo gives the option to do this via a patch already. It’s not completely stable but it mostly works. I’m not sure who the maintainer is as the patch seems to be wrapped up in Gentoo’s patch set.

  2. mgkimsal says:

    Do you have any more info on where I could find the patch itself, short of installing gentoo on my own? Thanks for the heads up!

  3. adaniels says:

    I highly doubt than someone will write that patch. You simple can’t have PHP4 and PHP5 both run as Apache2 module in the same process, because they use a lot of the same internal symbols (variables, function names, etc). If you would change that, nobody would be able to write any extensions which run both on PHP4 and PHP5. You can already run multiple PHP versions as CGI modules and there is no patch required for that.

    Please read my follow up article at http://blog.adaniels.nl/?p=48.

  4. mgkimsal says:

    I’m certainly no expert on the internals of PHP4 and PHP5, so there may likely be some conflict between the two which prevents mutual running. I was suggesting here that there’s incentive for someone to try to rectify that conflict as another approach to multi version hosting environments. Suggesting that some people run with a mix of mod_php and cgi isn’t going to cut it for everyone. Apps written that require mod_php will require it regardless of PHP version, so that’s not a viable solution.

    Some hosts already run every account in CGI mode, which has probably made it easier for them to offer a migration page for 4->5.

    My point on running multiple versions is not specifically to allow people to download code written for 4 and run it in 5 directly (the joomla example given on adaniels’ site), but for allowing people a transitioning strategy between the two. If I can, in my hosting environment, set up a separate version of the site, changing extensions to ‘.php5′ (for example), I can test which files work, and make changes to the ones that don’t, without my ‘live’ site going down. People can do that to some extent by running local copies of PHP5, but not everyone has the skills to setup and transfer a remote site to a local site just for debugging purposes.

    I’m actually a bit surprised that plesk hasn’t offered this sort of thing to LAMP customers. Given their size, stature and influence in the LAMP mass hosting arena, they’d be a perfect candidate to offer something like this. At the very least, offering a transparent method of setting up the fabled “second apache with proxy for php5″ that seems to be the preferred method people suggest in these situations. It’s a pain to set up and is not practical to setup on a case by case basis for many hosting companies.

    Perhaps cpanel or ensim offer this sort of setup and I’m not aware of it? Plesk 8 made a big deal of being able to choose PHP4 or PHP5 for each domain set up, but that’s a Windows-only version feature.

    Adaniels, you’re mentioning specifically Apache2, but I presume this is a limitation in the Apache1 world as well, correct?

    Thanks for the feedback. It’s an off the wall prediction, I know, but I wanted to have it out there in case someone does do this in the next year. A year is not that long a time, and I think we’ll still have a number of people with PHP4 specific code next year after the ‘support’ cut off date. Having many ways of making it easier for people to migrate to PHP5 is beneficial to the community as whole.

  5. ivo says:

    To do this with .php4 and .php5 would be a bad solution; it would require you to rename all files when you use third party products that already use .php.

    On our hosting environments, we solved this with an ‘apache mimetype hack’. It’s a small modification for apache that lets you specify the mimetype of a file in the .htaccess files and bind that to a module. This way, you specify in a .htaccess whether the directory should use the php4 or php5 module. No change to the applications required and works like a charm.

    However, this does not solve the migration issue; even if you can run both 4 and 5 on your server, 4 is going to be end of life, and eventually you’ll have to migrate those php4 apps to php5 anyway.

  6. adaniels says:

    Hi Michael,

    First of all I never use Apache 1, so I don’t know if it works.

    But I have to disagree with you again I’m afraid. I you want to migrate, you can setup multiple PHP versions to give your customers a chance to test. However, asking your customers to copy the files to a new dir and change all the extensions, won’t work. It’s to much work involved. In this article I explain that you can use an alternative port, so the customers can test: http://www.expample.com will still run PHP4 and http://www.example.com:8800 will run PHP5.

    Some customers will experience problems on PHP5, so you might want to keep running PHP4. In my article, you will find a solution for each occasion. Running PHP as CGIs or both as module with 2 running instances of Apache2. You can switch either with a .htaccess file or in DNS. Again, there is no need to write patch, the solutions are already here.

    About Plesk, CPanel and the rest, those control panels are broken in their core design. A control panel should only deal with creating new accounts and tracking invoices. Why does it control which Apache modules you can run or how to run them? Is makes no sense. I’m writing a brand new panel to compete with these products, based on the custom control panel I’ve written for Helder Hosting. It will allow you to do amazing things like `vi /etc/apache2/apache2.conf` to configure your server.

  7. mgkimsal says:

    Code that is written to expect to run as a php module in PHP4 won’t run as a CGI. Perhaps my entire experience is just a bunch of edge cases, but some code I’ve running expects PHP running as a module. Running as a CGI doesn’t cut it. It will be work to rewrite these things but work I’ll probably have to do.

    Why do you think product like plesk are broken in the core design? “A control panel should only deal with creating new accounts and tracking invoices. Why does it control which Apache modules you can run or how to run them?”. My plesk allows for turning Apache ASP, CF, PHP and other options off and on for different customers. The idea is that you can charge customers different prices based on the functionality and services they want. Turning off access to certain features for certain customers would be part of basic business. You could argue it’s better taken care of by running different virtual machines, and the economics of doing so are probably making more sense these days than it did a few years ago. I wouldn’t disagree. But I don’t see anything ‘broken’ in the design of turning things on and off for different accounts.

    Good luck on your hosting panel. Feel free to drop me a line if you’d like input or feedback. :)

  8. Adam says:

    Granted there are too many hacks like this for PHP – especially for the co-existence. However, most hosts survive by allowing you to add a couple of lines to your .htaccess file allowing you to freely switch between PHP4 and PHP5 at will.

Leave a Reply