The Zend Java Bridge provides PHP developers with a way to use existing Java code and build PHP applications that use Java code.The Java Bridge integrates Java code in PHP by connecting the PHP object system with the Java Bridge object system.
The Java Bridge requires that you have Oracle's JRE 1.5 (or later) or IBM's Java 1.5 (or later) installed on your computer. During (or after) installing (depending on the installation type), you are prompted to direct the installer to the JRE location. You should, therefore, already have JRE installed. More information about JRE and the latest updates can be obtained from www.java.com.
The Java Bridge PHP extension adds functions that allow you to instantiate new Java classes from inside your PHP script. Once a Java class is instantiated, the Java Bridge gets a message from the Zend Engine to execute the Java code. The Java Bridge executes the script and returns the results to the Zend Engine.
The Java Bridge is an optional component that is installed differently, depending on the operating system (WIN, UNIX) and the installation method format (EXE, DEB, RPM). Once the extension is installed and its status is On, PHP code can use the Java Bridge API to call Java objects.
The process of calling Java objects in PHP is described in the following diagram:
The Zend Java Bridge provides the following advantages:
- J2EE application servers can be extended to include the advantages that PHP offers (relative to other Web-enablement languages), such as reduced development time, reduced time-to-market, lower TCO (Total Cost of Ownership), etc.
- PHP-centric companies can take advantage of J2EE services that are not present in scripting languages.
- The PHP/Java Bridge provides the ability to interact with plain Java objects.
- The Java Bridge operates without the overhead of a JVM for each Apache process.
- The Java Bridge consumes a set amount of memory that is disproportionately small relative to the amount of activity that it handles.