-4

Most results I get on Google is how to get both versions running simultaneously on the same page but at different URLS but that's not what I want, I'd like for example to get http:\localhost to run PHP4 and PHP5 at the same time on the same page because I got a website that has old code from PHP4 that breaks up when loaded only in PHP5, and it has some parts made only in PHP5, so I would like to run both PHP versions at the same spot.

I'm on Windows XP running Apache, I wouldn't mind switching to IIS 2007 if it's required. I really need to do this I'm already aware of the security risk.

I know it's a repost but I got downvoted to oblivion because some of you don't want me to do this but I know I need to do this.

Update: the issue is that I have a site running locally that connects to a database I was told some of the code was in PHP4 and some in PHP5 and that both versions were required, I was assigned to fix this by running both versions, it's not a website that's connected to the internet so I figured no issues would happen.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • It's not possible to run both interpreters at the same time. You can only run one interpreter per page request. – hafichuk Nov 15 '11 at 16:32
  • Maybe you can tell us why you need to do this and we can help provide alternatives for you. – hafichuk Nov 15 '11 at 16:33
  • Not possible and would be rather stupid anyways, think of all the conflicts – rickyduck Nov 15 '11 at 16:33
  • Are you sure its the version that is breaking the old code and not just some of the ini settings or something? what exactly happens when you try to run the code on php5? – dqhendricks Nov 15 '11 at 16:39
  • No two runtimes at the same time. It's possible to mix output from distinct scripts however. For example `passthru("php4-cgi script2.php4");` embedded in the main script to invoke old code. (It's just not overly clever to do so.) – mario Nov 15 '11 at 16:47
  • @mario would you mind going in details about this? I'm interested. I'm a complete apache newbie. – user472755 Nov 15 '11 at 16:52
  • Did you know you have asked this twice? – BudwiseЯ Nov 15 '11 at 17:02
  • possible duplicate of [Running PHP 4 and PHP 5 at the same time on the same site using Apache on Windows](http://stackoverflow.com/questions/8139346/running-php-4-and-php-5-at-the-same-time-on-the-same-site-using-apache-on-window) – Mike B Nov 15 '11 at 18:11

1 Answers1

4

Nopez. Not possible.

I think you have two options:

  1. 'embed' the other php version (iframe / ajax)
  2. 'patch' the old project to PHP5

I had to the second option a couple of times and it is do-able (all depending on the size and the code used of the project of course).

PeeHaa
  • 71,436
  • 58
  • 190
  • 262