You may want to consider running your PHP 5 tool in a container, e.g. Docker. PHP 5 is nearing End-of-life and if you use PHP 7 on the same machine you may run in to conflicts.
Use Docker or LXD container systems to build a small PHP 5 environment, run it inside Ubuntu 18.04, and forward all web requests requiring PHP 5 to it. I hear you can actually convert an entire VM of Ubuntu 12.04 or 14.04 to a container with lxd-p2c and run it inside Ubuntu 18.04, kind of like they do in this presentation: "Turning physical systems into containers Migrating to system containers"
You can also set up a second server (or VM) and just have Apache on the 18.04 main system to proxy requests for sites requiring PHP 5 to it. That system does not need to be web accessible, as the 18.04 system will be the one exposed to the outside world. If you require register_globals, you can either use Ubuntu 12.04 with PHP 5.3.2 which is no longer officially supported, or Ubuntu 14.04 with PHP 5.5.9 with a code snippet at the start of all your files to emulate register_globals. I forget the code snippet but you can look it up. Here's the relevant config files that should probably work for proxying an SSL site from one server to another, assuming the rest of your config is proper and the requred mods are enabled:
On Ubuntu 18.04 Apache server doing the proxying at 192.168.1.2:
#requires mod_remoteip and mod_proxy
RemoteIPHeader X-Forwarded-For
TrustedProxy 192.168.1.2
SSLProxyEngine On
ProxyPreserveHost On
ProxyPass / https://example.org/ retry=0
ProxyPassReverse https://example.org/ retry=0
On Ubuntu 14.04 server being proxied to at 192.168.1.3:
#requires mod_proxy
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 192.168.1.2
RemoteIPInternalProxy 192.168.1.1 #assuming your router IP is 1.1
It is not recommended to continue PHP 5.6, which is EOL Since Dec 31 2018!
But you can install PHP5.6 from a PPA:
source: https://askubuntu.com/a/762161/34298
You may want to consider running your PHP 5 tool in a container, e.g. Docker. PHP 5 is nearing End-of-life and if you use PHP 7 on the same machine you may run in to conflicts.
There are several official Docker images available for PHP 5: https://hub.docker.com/_/php/
Several choices, as mentioned by the other answers:
Like this:
Use Docker or LXD container systems to build a small PHP 5 environment, run it inside Ubuntu 18.04, and forward all web requests requiring PHP 5 to it. I hear you can actually convert an entire VM of Ubuntu 12.04 or 14.04 to a container with lxd-p2c and run it inside Ubuntu 18.04, kind of like they do in this presentation: "Turning physical systems into containers Migrating to system containers"
You can also set up a second server (or VM) and just have Apache on the 18.04 main system to proxy requests for sites requiring PHP 5 to it. That system does not need to be web accessible, as the 18.04 system will be the one exposed to the outside world. If you require register_globals, you can either use Ubuntu 12.04 with PHP 5.3.2 which is no longer officially supported, or Ubuntu 14.04 with PHP 5.5.9 with a code snippet at the start of all your files to emulate register_globals. I forget the code snippet but you can look it up. Here's the relevant config files that should probably work for proxying an SSL site from one server to another, assuming the rest of your config is proper and the requred mods are enabled:
On Ubuntu 18.04 Apache server doing the proxying at 192.168.1.2:
On Ubuntu 14.04 server being proxied to at 192.168.1.3: