PHP needs to interact with Java Library. Suggestions?
I have been creating a web page that is based on PHP/Smarty. I have recently came to a realization that the web page will need to interact with a Java library. My problem is that the interaction is too detailed to create an executable with the JAR, and I am not sure how to go about interacting with this library. Basically, I have a list of user input in a PHP/Smarty form, that needs to be used in this java library. Any suggestions on how to do this? This is what I am thinking, but it seems a little unconventional:
Present the form to the user, when the user submits, it passes to Tomcat, which deals with the POST data, and interacts with the JAR file. Any other ideas? Thanks. |
There are a couple of ways to achieve what you want, however I must say up front I've never tried to integrate Java & PHP, however look up the chapter in the ever friendly PHP manual called: PHP / Java Integration. The introduction reads as follows:
"There are two possible ways to bridge PHP and Java: you can either integrate PHP into a Java Servlet environment, which is the more stable and efficient solution, or integrate Java support into PHP. The former is provided by a SAPI module that interfaces with the Servlet server, the latter by this Java extension. The Java extension provides a simple and effective means for creating and invoking methods on Java objects from PHP. The JVM is created using JNI, and everything runs in-process." I hope the chapter helps you. |
All times are GMT -5. The time now is 06:20 PM. |