0

I maintain for someone code of an old PHP4 app. Since certain new features could make good use of ZEND framework, I wonder, if I could mix PHP4 and PHP5 within a single app.

To be more specific, I'd like to call PHP5 code from within PHP4 code.

A simple solution would be a new directory XXX, which holds the new PHP5 stuff. Then call from within PHP4 classes PHP5 code using HTTP sub-requests. Since the features in question are seldom used administrative functions, this approach shouldn't throttle the overall performance.

Alternatively, I wonder, if I may include files from the PHP5 world from within PHP4 scripts directly.

Most likely, this isn't possible, since the web-server runs PHP4 and PHP5 in separate processes/address spaces.

In case I missed something, could someone confirm? Or point into another direction?

hakre
  • 193,403
  • 52
  • 435
  • 836
SteAp
  • 11,853
  • 10
  • 53
  • 88
  • Most PHP4 for still runs on PHP5. Just try to switch completely to PHP5 and see how it goes. You'll probably have to get rid of some warnings/notices but it should work fine. – halfdan Apr 17 '11 at 18:52
  • The ISP provides PHP4 and PHP5. Switching to PHP5 renders errors. But someone need to pay the bill fix the errors and complete the migration ;-) – SteAp Apr 17 '11 at 19:47

1 Answers1

1

The only way this could be done is by enabling remote fopen() wrappers and invoking the PHP5 code by URL. This seems like a really Bad Idea.

Winfield Trail
  • 5,535
  • 2
  • 27
  • 43
  • Granted! It is a bad idea! The whole project should be migrated. I already explained 'someone' that she should do... – SteAp Apr 17 '11 at 19:15
  • I feel your pain, Stefan. I hope you manage to explain it to your boss. – Winfield Trail Apr 17 '11 at 22:03
  • Thx! I implemented a class, which traps call to its methods in the PHP4 wordl, wraps them in a POST request and finally passes them over to the PHP5 world, which dispatched them to the right target class. Wasn't that complicated, but... – SteAp Apr 20 '11 at 22:34