6

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?

0

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

The first one is not PHP (but rather a kind of distribution with webserver, etc.) The second one is... well... a protocol to access a web service with PHP. I don't know why one would need software for that at all, you could just write it down using cURL. Completely useless.
@AndreKR Wouldn't it be the same has having JYthon or any of the other JVM implementations of another language?
1

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.

1 Comment

You're right, it's not really reasonable. Unfortunately I have a third-party Java client library (or, alternatively, a .net version) I need to make a few calls to and I don't want to set up Tomcat or some other unmaintainable Java crap. I think, I'll go for the command line.
1

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.