Detailed analysis of PHP and Java integrated development is strongly integrated with page 14th. As time passes, the two highlights become increasingly bright and soon become popular with programmers. some people have doubts: if they encounter each other, what will happen, these two highlights have become more and more bright, and soon they have been liked by programmers, so some people have doubts: what will happen if they encounter the two? Is it possible to combine their strengths?
Try to build a bridge between PHP and Java, and use this bridge to establish a communication channel between the two entities. with the help of this bridge, you can develop classes in Java, then they are called in PHP. Similarly, PHP scripts can be used in your Java desktop or Web applications.
In this article, you will learn how:
◆ Install and configure the PHP/Java Bridge
◆ Use Java classes in PHP scripts
◆ Use PHP scripts in Java classes
◆ Use PHP scripts on the JSP page
Let's get started!
Install and configure the PHP/Java Bridge
The latest PHP/Java bridge zip package can be found.
◆ For J2SE, the installation is very simple:
◆ Install J2SE 1.6 or later
◆ Install PHP 5.1.4 or later
Decompress the php-java-bridge_5.2.2_j2ee.zip package
Enter the directory after decompression from the command prompt, and enter:
?> Java? Classpath JavaBridge. war TestInstallation
In this folder, you should see an ext directory, which contains four. jar file, copy the JavaBridge. jar and php-script.jar to the ext folder under your J2SE installation directory (usually {JAVA_HOME}/jre/lib/ext ).
For J2EE, perform the following installation steps:
Copy the JavaBridge. war file to the auto_deploy folder under your J2EE Server or servlet engine (Tomcat, Resin, etc.
Rename the file according to your application, restart the J2EE Server, and wait for the automatic deployment process to create and. war file directory. In this example, this application is called appName. war.
Test the new application in a browser, enter http: // localhost: 8080/appName, and click test. php.
If your J2EE Server runs on different hosts and ports, modify the parameters accordingly.
Note: If you want to run J2EE/PHP applications on Apache or IIS, copy the directory containing appName to the root directory of Apache/IIS documents.
...