PHP-GS is an example of possible Php/GigaSpaces Interoperability.
Objectives
PHP is a scripting language that is especially suited for Web development and can be embedded into HTML.
It is one of the most widely used web technologies. It is used mainly in server-side scripting. PHP scripts are interpreted by the Zend Engine - the core scripting engine of PHP.
GigaSpaces is based on Java. So the challenge is the PHP and Java interoperability. Although PHP users and Java users can take advantage of application developed with mixed Java/PHP:
- PHP libraries written in Java are fast, safe, and relatively easy to develop, compared with C libraries. Since Java is the library language, developers won't need to be paranoid about third-party libraries having C-memory problems or segvs.
- PHP applications can take advantage of Java libraries and capabilities like JMS, SOA frameworks, Hibernate, Spring or GigaSpaces.
- Java application can move presentation code to PHP, leaving behind templating systems, or languages with small libraries, and taking advantage of PHP flexibility and capability.
PHP-GS offers a solution to use GigaSpaces in a software architecture based on PHP technologies.
We have identified good software and practices.
This allows, for example, to use PHP for the presentation layer and Java/GigaSpaces layer for the business tier.
This integration enables the use GigaSpaces to address performance problems on (existing) web site written in PHP.
Roadmap
Bridge between PHP and Java
There are at least 4 technologies which offer a bridge between Php and Java which offer a similar API:
- The PHP/Java bridge is an optimized, XML-based network protocol, which can be used to connect a native script engine, PHP, with a Java or ECMA 335 virtual machine. It is open source and free.
- Zend, similar to Php/Java Bridge from a technical point of view. It seems most successful (I don't test it). It is produced by Zend, the Php company.
- Quercus is a pure Java implementation of PHP 5 and extensions like PDF, PDO, MySQL, and JSON. Quercus is produced by Caucho, it is released under the Open Source GPL license.
- Furthermore IBM's Zero framework for Eclipse contains a PHP interpreter written in pure Java and a php to java bridge which can call Java methods in-process.
The two first build a bridge between two execution environments. The two last translate PHP into java bytecode a bit like a JSP engine.
Examples
FastConnect example
Using PHP/JavaBridge, only tested on Linux and runs Java within Apache.
GigaSearch example
Using PHP/JavaBridge, works within a Servlet server, like Tomcat, Jetty, etc. Using the Web Container feature of GigaSpaces 6.6, it can be deployed as a Processing Unit in GigaSpaces, making a PHP application dynamically scalable without change.