Quercus: PHP in Java
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Quercus
Servlets and Filters
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Tutorials
JSP
Resin 3.0
Tutorials

Quercus is Caucho Technology's fast, open-source, 100% Java implementation of the PHP language (requires JDK 1.5).
PHP Tutorials
Quercus: Hello, World installation

The Hello, World tutorial covers the basic steps to start Resin and run a trivial php script in Quercus.

Quercus: Java and PHP integration

Adding PHP functions with a Java module.

Quercus JSON

JSON (JavaScript Object Notation) is a popular text data exchange format with built-in support from Quercus since Resin 3.0.20. One of the common uses of JSON in a PHP environment is for the server to send JSON data to the user's browser.

  1. Overview
    1. PHP Users
    2. Java Users
    3. New Java/PHP Architecture

Overview

Implementing PHP in Java brings benefits to both PHP users and pure Java users. And developers who are clever enough to use PHP in combination with Java will gain the most.

PHP Users

PHP developers will gain from using Quercus, even if they have no intention of writing Java code. Because Quercus is written for Resin, a Java application server, it gains all the advantages of Java applications including:

  • Security: since Quercus and its modules are entirely in Java, C pointer overruns and segmentation violations are no longer possible.
  • Scalability: PHP programs can take advantage of distributed sessions in PHP and load balancing.
  • Performance: Quercus outperforms a straight mod_php implementation by about 4x (for Mediawiki and Drupal). Quercus roughly matches PHP performance with accelerators like APC.
  • Caching: PHP applications using Quercus can immediately take advantage of Resin's proxy caching. They can also use the PHP APC caching API since the APC functions are included with Quercus.
  • Connection pooling, transactions, JMS: PHP programs using Quercus automatically take advantage of Resin's connection pooling, and can use the full distributation transactions, and Java capabilities like JMS.
  • Java tools: PHP developers can use Java tools like profilers to get in-depth information about the PHP program performance.

Java Users

  • Java developers can use Quercus immediately to deploy PHP applications such as MediaWiki, Drupal, Wordpress, Gallery2 and DocuWiki.
  • Since Resin's administration uses PHP to script JMX beans, Resin users can customize the administration views of the JMX management.

New Java/PHP Architecture

Although PHP users and Java users can take advantage of Quercus immediately without modifying their application, the real benefits come from developing mixed Java/PHP applications:

  • 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, or Spring. (Or EJB if you really wanted.)
  • 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.

JSP
Resin 3.0
Tutorials
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.