Currently we're using PHP for our websites. Now we're thinking about writing the backend in Java, because of the type safety of the language, and the availability of all kind of tools for Java. I've been reading about Java Bridge and now I'm wondering how to set this up.
We're using PHP already through Apache. I read that to use Java Bridge I need to install Tomcat as well. That means I have two servers (Apache and Tomcat), and I need to add security to the backend, because it is open to the whole wide world suddenly... Am I missing something? Is there another way to make the PHP-Java connection without an additional server? How is this usually done?
Any directions or links on how to to do this or any best practices on how to set it up are greatly appreciated. I didn't find the official Java Bridge site very clear. Thanks!
I am currently testing the use of the Zend Java bridge. Two weeks ago, I did test the PHP/Java bridge open source solution. This one does require that you put your java classes into a war deployed in a web server (I did use Tomcat 6). The Zend solution does not require a web server. If you put your business logic in plain java classes, you simply wrap your classes in one (or several) jars. You then start the Zend java bridge daemon into a JVM, passing to the -classpath the Zend Java bridge jar aswell as your own jar's
Ex from a dos windows:
C:\Development\ToolsPHP\ZendServer\bin>java -classpath javamw.jar;mybusinesslogic.jar -Dzend.javamw.port=10002 com.zend.javamw.JavaServer.
Here, I had to specify a port since the 10001 port, which is the default for the bridge, was already in use (use netstat -a to detect port conflicts). Note that the Zend solution only works if your php script is executed on the Apache server managed by the Zend server (community or commercial edition) and that the Zend Java bridge service is running, with its port set to 10002 with the Zend server admin console.
To implement my business logic, I plan using simple Java pojo's, Spring, JPA and Hibernate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With