Connect PHP and Java--Php/java bridge [1]

Source: Internet
Author: User
Tags connect php and client

In the Web development marketplace, Java and PHP are the hottest technologies currently in use. The power of Java is undeniable, not only in web development, in various software applications, Java ubiquitous. and PHP in the open source power and zend,ibm,oracle and other companies under the impetus of the growing prosperity. Some people may not believe that "PHP will be more popular than Java," said Marc Andreessen, the internet pioneer, but "PHP is targeting the enterprise market, and a head-on battle with Java" is really underway, and the technology used by 22 million of sites around the world has to be taken seriously.

The two technologies can compete fiercely and work closely together. From a customer's point of view, the convergence between technologies is important because a large application system is often not able to be done independently by a single language/and technology. The advent of Php/java Bridge will be a link between PHP and Java, providing a good choice for businesses that need to combine PHP with Java.

Haohappy on the Java EE not deep understanding, if there are related content to understand the error, welcome criticism advice.

  (a) What is a JSR and what is JSR223?

A JSR (Java specification request) is a formal request to the JCP (Java Community Process) to propose a new standardized technical specification. Anyone can submit a JSR (Java spec request) to add new APIs and services to the Java platform. JSR has become an important standard in the Java world.

In the Java servlet specification (servlet 2.4,jsr-154), a series of core abstractions are defined (the various objects that need to be considered during web process processing) to allow Java programmers to write web programs, including Session,request, Response and so on. When programmers are writing programs, they can easily and securely communicate with these objects. JSR223 describes how these Java objects are opened to Web pages written in other scripting languages, so that other languages can access them as well. The current specification will be used in PHP, but this concept is independent of the scripting language, meaning that it may be applied to other scripting languages outside of PHP in the future. In a word, the purpose of JSR223 is to integrate the scripting language on top of the Java platform.

  (b) What is Php/java Bridge?

Php/java Bridge contains a PHP module (including Java.so,php_java.dll) and a related back-end program (Javabridge.jar,javabridge.war or MonoBridge.exe), Used to connect the object system of PHP to the Java or ECMA 335 (CLI, an important subset of the Microsoft. NET framework) virtual machines. It fully implements the JSR 223 specification request, allowing PHP scripts to access applications based on the CLR (such as vb.net,c#) or Java (Java,kawa,jruby). Php/java Bridge communicates with the virtual machine via a local socket with an efficient communication protocol. A multiple-process HTTP server has a corresponding virtual machine process for each processing request of the PHP process.

Requests from multiple HTTP servers are centrally sent to an application server running Php/java Bridge, or each HTTP server has a Php/java bridge and communicates with a Java EE application Server, the required client class library (EJB Client.jar) will be loaded at run time.

If there is at least one back-end program running in the ECMA virtual machine, such as Novell's mono or Microsoft. NET, then classes based on ECMA 335 can be accessed or supported varargs, reflection,assembly Loading and other characteristics.

If there is a back-end program running in the Java EE Environment, the session sharing between PHP and JSP can be realized and the cluster and load balance can be realized.

Unlike previous attempts (examples of Ext/java or JSR223), Php/java Bridge no longer uses JNI (Java local interface). The PHP object will come from the HTTP (apache/iis) pool, and the Java/j2ee object is allocated from the back-end program. Objects are communicated through the communication delivery style (continuation passing style), see Java_closure () below. Once a PHP object crashes, it does not affect the Java application Server and servlet engine.

Starting with Php/java Bridge version 3.0, we can also use Java as a running environment for PHP scripts. Java code can allocate and invoke PHP scripts through an external or internal Java pool. Script objects can come from an external HTTP pool, or an internal PHP fastcgi pool or directly using a PHP CGI. This feature requires Java 6 (expected to be launched in the first half of 2006) or external javax.script packages.



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.