Call Java method from PHP5

There used to be a PHP extension that could load Java libraries and call methods on them. This was for PHP 4.

Is there a way to do the same in PHP 5?

+6
java php binding
source share
3 answers

It doesn't seem like there is a built-in way, even support in php4 was experimental. Actually it makes no sense to run a Java virtual machine on every request for php. You can always use the shell shielding capabilities (backtick operator) if you need to do something in Java, but if you want to do something scalable, it should be its own Java service and accept SOAP / REST or whatever wanted to talk to her from php.

+1
source share

If you need Java integration in PHP 5, there is a Java Zend Server bridge:

http://www.zend.com/en/products/server-ce/

and "PHP / Java Bridge":

http://php-java-bridge.sourceforge.net/pjb/

EDIT

If you do not like any of the above options, consider using Quercus . This is a Java implementation of PHP that makes it easy to reference Java from PHP and vice versa

+4
source share

You can use Quercus. This is the PHP 5 runtime environment written in Java, which you can install on top of the JavaEE application server.

http://www.caucho.com/products/quercus/

+1
source share

All Articles