tags:

views:

35

answers:

2

I need to support some legacy code on a server where I need to be on the latest stable PHP version at all times. I can't possibly update the code base every time I upgrade so I'm wondering if there is a way to run this specific site with an older version of PHP than the one installed.

Example: I'm running PHP 5.3.3 and my code for an old site is broken. It was running perfectly on 5.2.x. Can I simply put a command in at the top of the script(s) to run it as 5.2.x so that I don't have to fix broken code the next time I upgrade to 5.4, 5.5, etc?

TL;DR: Is there a function like this:

exec_as_php_version('5.2.14');//?

+2  A: 

No, there isn't. Welcome to version dependence hell.

Michael Borgwardt
@Though not, thanks :)
sudopeople
+1  A: 

it is never forward compatible.

this is one solution i have seen earlier, but it is a VERY BAD IDEA: http://blog.dynom.nl/archives/Multiple-PHP-versions-on-one-webserver_20091103_53.html

deepsat
Good to know. Let's hope it never gets this bad.
sudopeople