PHP and Java Integrated Development detailed analysis strong cooperation page 1/4 _ PHP Tutorial

Source: Internet
Author: User
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.

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.