Enable PHP5 on Media Temple PHP4 Grid Service


Since Media Temple Grid Service runs PHP as an Apache module, you can simply add the following lines to any .htaccess file:

  1. Action php5-script /gs-bin/php-5.2.6-1
  2. AddHandler php5-script .php

Be sure to replace '-5.2.6-1' with a PHP version that is supported on your server.

One of my favorite parts of being a web developer are the countless challenges that present themselves to me on a regular basis. It's the challenges that really keep me motivated; not repeating what I already know how to do. A natural consequence of challenging work is making mistakes, and as such I have always been a fan of the adage "If you're not failing, you're not trying hard enough." I'm a firm believer that mistakes often provide the very best opportunities to learn once you're able to put your ego aside, so here we go...

Last week I made a pretty big mistake: I got busy writing an PHP5 application for an existing site without first ensuring that the destination hosting space (a Media Temple grid-service package) supported PHP5. All of my beautiful object-oriented code fell apart on the grid service's PHP4, and after freaking out for at least two minutes a quick Google search reminded me that it's beyond easy to specify a PHP version within an .htaccess file. This meant that I could leave the current site intact with the old PHP version (refactoring the entire site to be compatible with PHP5 wasn't part of the budget or on my short list of ways to spend my time) that it had been built around and then just declare a different PHP version within my application's .htaccess since the app lived within it's own folder. Whew!

More detailed instructions for accomplishing this task are available at http://kb.mediatemple.net/questions/244/How+can+I+specify+the+PHP+versio...