开发者

Call Java method from PHP5

开发者 https://www.devze.com 2023-02-01 18:55 出处:网络
There used to be a PHP extension that could load Java libraries and call methods in开发者_如何学运维 them. That was for PHP 4.

There used to be a PHP extension that could load Java libraries and call methods in开发者_如何学运维 them. That was for PHP 4.

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


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

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

and "PHP/Java Bridge":

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

EDIT

If you don't like either of the above options, then consider using Quercus. This is a Java implementation of PHP, that makes it easy to reference Java from within PHP and vice-versa


Doesn't look like there's a built-in way, even the support in php4 was experimental. Doesn't really make sense to start up a Java Virtual Machine on each request for php. You could always use the shell-escaping capabilities (backtick operator) if you have to do something in Java but if you want to make something scalable it needs to be its own Java service and accept SOAP/REST or however you want to talk to it from php.


You could use Quercus. It's a PHP 5 runtime written in Java you can install on top of a JavaEE application server.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号