Reputation: 11
I'm writing a web app on my system using PHP5, but the app needs to be compatible with PHP4. Is there any way to emulate PHP4, or at least issue warnings?
Thanks.
Upvotes: 1
Views: 996
Reputation: 7225
There is no way to emulate PHP4 that I'm aware of. You need to run your code in a real PHP4 environment. Here's what I'd suggest:
Once that is done, you can more or less forget about the VM. All you need to do is keep it running. Change your code in your app dir as before. You can run it from your browser with the IP of the virtual machine.
(Perhaps you could even install an old version of XDebug in the VM and do proper remote debugging from within your IDE. But I don't know if XDebug is compatible with PHP4 at all.)
Upvotes: 1
Reputation: 437366
No, there isn't. You will have to install PHP 4 on the machine to provide the runtime environment. Or, even better, convince the client that PHP 4 in 2012 is... outdated.
Upvotes: 0
Reputation: 324630
As a general rule, if you avoid functions and arguments that were added in PHP5 (as shown in the documentation for each function), then it should work just fine with PHP4. PHP is good at backwards-compatibility like that.
Upvotes: 1