Running parallel versions of PHP – Part 2

The hard part is over, now for the easier stuff – for this part you’ll need:

  • Coffee
  • Patience

Now we compile and install:

Now if all goes well – the prefix you used in your configure (--prefix=/whatever)
will have the following directories in it:

The file we care about the most is located in the bin/ directory – called php-cgi.

First we need to enable the action module in Apache if it isn’t already:

Now we need to modify either a specific config file in the sites-enabled/ directory or your actual apache2.conf , add this line to where you deem appropriate:

* Make sure you change “/home/rovangju/misc/php53” to where you set your --prefix=/whatever/ value is. Leave the /bin at the end.

Next, simply reload apache: /etc/init.d/apache2 force-reload, if done right you shouldn’t get any errors.

We’re almost there!

Ok, now for the magic part, for demonstrative purposes – make a the following file structure in a browser-visible spot on your server:

Fill the index.php files with phpinfo(); – the idea is to just show the php version.

Now place this into php_test/php53/.htaccess:

This will re-map all .php files under that path to the newly compiled php-cgi file I mentioned earlier.

Now point a browser to both of those index files and hopefully you should see the version differences.

Troubleshooting notes:

  • Depending on where you actually put these files – the .htaccess may not be allowed to override the server defaults.
  • Your Apache error log is your friend !
  • If you get the timezone error like I did for strtotime, you can set it in your php.ini
  • Try restarting Apache once more – sometimes .htaccess files can be fiesty.
No Comments

Start the ball rolling by posting a comment on this article!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">