jetty with php


最新版是Quercus 4.0.3,下载地址:

4.0.3 .war src源文件 2010-01-11

使用:   最简单直接的方法,就是解压放Quercus压缩包到java应用服务器,如Tomcat的wepapp目录,其他的配置同Tomcat,tomcat配置在此不说了,删除目录里不需要的image目录什么的,然后在里面直接放你的php程序就可以了。 








        Quercus is Caucho Technology’s 100% implementation of 5 released under the Open Source GPL license. Quercus comes with many modules and extensions like PDF, PDO, MySQL, and JSON. Quercus allows for tight integration of services with PHP scripts, so using PHP with JMS or Grails is a quick and painless endeavor.

With Quercus, PHP applications automatically take advantage of Java application features just as connection pooling and clustered sessions.

Quercus implements PHP 5 and a growing list of PHP extensions including APC, iconv, GD, gettext, JSON, MySQL, Oracle, PDF, and Postgres. Many popular PHP application will run as well as, if not better, than the standard PHP interpreter straight out of the box. The growing list of PHP software certified running on Quercus includes DokuWiki, Drupal, Gallery2, Joomla, Mambo, Mantis, MediaWiki, Phorum, phpBB, phpMyAdmin, PHP-Nuke, WordPress and XOOPS.

Quercus presents a new mixed Java/PHP approach to web applications and services where Java and PHP tightly integrate with each other. PHP applications can choose to use Java libraries and technologies like JMS, EJB, SOA frameworks, Hibernate, and Spring. This revolutionary capability is made possible because 1) PHP code is interpreted/compiled into Java and 2) Quercus and its libraries are written entirely in Java. This architecture allows PHP applications and Java libraries to talk directly with one another at the program level. To facilitate this new Java/PHP architecture, Quercus provides and API and interface to expose Java libraries to PHP.

The Quercus .war file can be run on Java application servers such as Glassfish, i.e. it can be run outside of Resin. This .war file includes the Quercus interpreter and the PHP libraries.

If you are new to Quercus, please check out:

原来java 下部署 php也可以这么容易的,注意mysql等数据库需要通过JNDI来进行连接,毕竟人家还是Java环境,Fuck,下面是详细的README文件内容:

Copyright (c) 1998-2009 Caucho Technology. All Rights Reserved.
This is the README file for Quercus(tm)
  I)    Introduction
  II)   Getting Started
  III)  Using a database with Quercus
  IV)   JDBC Connections
  V)    Quercus Open Source vs. Quercus Professional
  VI)   Quercus on Tomcat
  VII)  Quercus on Glassfish
  VIII) Resources
I) Introduction
Thank you for downloading the Quercus standalone .war package.

Quercus is Caucho Technology’s 100% Java implementation of PHP 5.
II) Getting Started
First, make sure you are running JDK 5 or greater.

Then follow your server’s instructions for deploying a war file.  After
deploying, browse to the Quercus webapp and the index page will check that
Quercus is correctly deployed.
III) Using a database with Quercus
Quercus only needs a JDBC driver in order to use a particular database.
To use the PHP mysql functions, you will need the MySQL JDBC driver.
IV) JDBC Connections
Quercus is able to use database connections from a DataSource configured
using JNDI.  Application servers typically provide a mechanism for making a
connection pool DataSource available with JNDI.

Quercus database connection methods accept the JNDI name directly:

  $conn = mysql_connect(“java:comp/env/jdbc/myDatabaseName”)


  $pdo = new PDO(“java:comp/env/jdbc/myDatabaseName”);

If the web.xml contains a configuration for a JDBC database, then Quercus will
ignore the arguments to PHP database functions and will connect directly to
the preconfigured database.


Quercus will use the above database for all calls to the database like the
ones below:

  $conn = mysql_connect(“localhost”, “user”, “pass”);


  $pdo = new PDO(“mysql:host=localhost”, “user”, “pass”);

Consult the documentation for your application server for instructions on
configuring a database and making it available with a JNDI name.
V) Quercus Open Source vs. Quercus Professional(丫的,居然还留了一手,我靠)
Quercus Professional offers significantly faster performance over
Quercus Open Source because it compiles php scripts to java source code.
To use Quercus Professional, you will need to:

1) Download Quercus Professional standalone.
2) Have a valid license file.
3) Specify the location of your license in your web.xml.

<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE web-app
    PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN”
    <servlet-name>Quercus Servlet</servlet-name>
VI) Quercus on Tomcat
1) Download the latest Quercus standalone war file.

2) Place the war file in your webapps directory for a war deploy, or extract the
   war contents into your webapps/ROOT directory.

3) Start Tomcat.

4) Quercus should now be running.  To check, browse to the Quercus webapp and
   an index page will test to see if Quercus is running.

The following step is only needed if you intend to use a database in
Quercus with Tomcat:

5) Download the appropiate database driver and place it into Tomcat’s
   lib directory.
VII) Quercus on Glassfish
You can use autodeploy or deloy the webapp via the Glassfish web admin:

1) Download the latest Quercus .war file from

2) Log into Glassfish web admin.

3) Click on deploy Web Application (.war).

4) Point Glassfish to the location of the Quercus .war file’. Then click OK.
   Glassfish will automatically deploy Quercus.

5) Quercus should now be running.  To check, browse to the Quercus webapp and
   an index page will show up indicating the status of Quercus.  Or you can
   click on “Launch” from Glassfish admin’s “Web Applications” page and your
   browser will go to the Quercus webapp.

6) PHP files can now be added to the root directory of the expanded web

The following steps are only needed if you intend to use a database in
Quercus with Glassfish:

7) Download the databse driver and place it into Glassfish’s
   lib directory.

Follow the next steps if you want to configure a JDBC connection.

8) In Glassfish web admin, create a JDBC Connection Pool.  Specify the database
   name, username, and password.

9) In Glassfish web admin, create a JDBC Resource with a JNDI name , for example

10) Configure Quercus to use the JDBC database by adding a tag to

VIII) Resources
   Go here for documentation, guides, examples, and Quercus downloads.

   Report bugs here.

   Forums for Resin, Hessian, and Quercus.

   Mailing lists for Resin, Hessian, and Quercus.

更全的文档 quercus: php in java: