Java Bridge
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 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.
Zend Server includes the Java Bridge PHP Extension and the ability to restart the Java Bridge and configure the Java Bridge settings ( Administration | Components).
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:
Advantages
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.