Page 1 of 1

Integrating Java with PHP without recompiling

Posted: Wed Oct 27, 2004 4:13 pm
by juher
I am currently in the process of migrating an application from windows to linux.
My boss wrote the app originally and uses a java api written by some one else. It only works becuase the windows version of php he has has support for running java inside the cole like so:

Code: Select all

<?php
  $myObject = new Java("the.class.we.want.to.run");
  $myObject->doParse($_GET['var1'], $_GET['var2']);

  if($myObject->isVerified()) 
  {
      do_some_stuff();
   }

?>
However, he also insists on going strictly RedHat Network all they way on the server. Becuase RHN's PHP package does not have java compiled in, it doesnt work.

Is there anyway to run this java app without compiling my own PHP?

thanks
j

Posted: Wed Oct 27, 2004 5:00 pm
by kettle_drum
Its really not that hard to compile PHP from the source code and it seems the easiest way to solve your problem. There are plenty of tutorials on how to do it, and there is always help here. To make things even easier for you all you need to do is run phpinfo() and get the configure line from the first table of information and then copy that to use on the source code and add on the java line to that. So you can just:

1)Download source.
2)Untar the code
3)./configure <data here>
4)make
5)make install clean

Could have had it done by the time you waited for this reply :P

um.. thanks

Posted: Fri Oct 29, 2004 10:05 am
by juher
I would rather compile it from source. But I am a temporary employee and I'm the only one who has idea how to do that.

I was wondering if there was a workaround so, when I leave, my boss could use rhn to update php like everything else.

Thanks though.

J

Posted: Fri Oct 29, 2004 11:01 am
by Christopher
Weite a command line interface and use exec() like:

exec('java /path/to/my/program isVerified');