Call Java method from PHP5
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/
精彩评论