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');//?
To run two or more PHP versions for different sites on the same LAMP stack by using mod_fcgid to create a . fcgi wrapper script. The script forwards all the PHP requests which were made from php-cgi binary. Considering a server running on PHP 7.2 where a specific site requires an older PHP version (eg PHP 5.6).
Yes we can run several versions of php. To do that we must have to check the INSTALL file, if it is included in PHP source distribution.
No, there isn't. Welcome to version dependence hell.
Edit: Now, 10 years later, this would not be terribly difficult - just run different PHP versions in separate Docker containers. It's still a bad idea to run really old PHP versions for security reasons, though.
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 (link does not work)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With