php4 and php5 - whats the best way?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nolanpro
Forum Newbie
Posts: 17
Joined: Fri May 12, 2006 5:17 pm

php4 and php5 - whats the best way?

Post by nolanpro »

I’m in a rather strange predicament. I’ve got some php5 files I need run from a php4 system. If my php5 files were actually php4, I would just include or require them in my php4 files and everything would be great.

My server allows both php4 and php5, as long as the php5 files are named with a php5 extension.

Is there a way to eval or exec php5 scripts from a php4 file? If so, how would I pass values to it? I suppose I could curl or fsockopen but that sounds messy.

I really wish those files weren’t php5 but they need the php5 soap functions. The content management system I’m incorporating it with is all php4 and it doesn’t support php5.

Any help would be greatly appreciated!

Thanks!!!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If you nedd php 5 functionality let php 5 handle the request (including all necessary script files).
nolanpro
Forum Newbie
Posts: 17
Joined: Fri May 12, 2006 5:17 pm

Post by nolanpro »

The problem is the php5 files are just a small insert in a joomla CMS. Because all scripts in joomla are dependent on each other (and dependent on php4 unfortunately) I cant just seperate part of the site and make it php5.

What I'm hoping to do is just pop in a require, include, exec, eval or anything at a certain point in the joomla script, that will run those php5 files (as php5). But I also have to send at least one variable (could be an array) to that php5 file from where is called in php4.

Thanks!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.joomla.org/content/view/154/52/ wrote:Joomla! will support installation and use with PHP 5 and MySQL 4.1
Are there any issues with running joomla with php5?
nolanpro
Forum Newbie
Posts: 17
Joined: Fri May 12, 2006 5:17 pm

Post by nolanpro »

I’ll look into that, people use to complain about lots of errors in joomla on php5 but maybe there fixed now.

Are all functions of php4 useable in php5?
nolanpro
Forum Newbie
Posts: 17
Joined: Fri May 12, 2006 5:17 pm

Post by nolanpro »

I would use

Code: Select all

<? system("php5 thefile.php5", $return); ?>
from a php4 file but it returns a fork error, even though it works perfectly on the command line.
Post Reply