Based on the success of using Ruby (RoR), I decided to trying moving some PHP applications over to GlassFish.
I read a great blog article by Ludovic Champenois called 100% Java Quercus PHP engine running in GlassFish Java EE 5 Application Server It describes how to use an open source engine called Quercus from Caucho. I tried to follow the directions, but could not get it to work. I imagine because the versions of GlassFish application server and Quercus may have been different. I was not deterred.
I came across a follow-up article by Arun Gupta called PHP in GlassFish using Caucho Quercus. This article was the missing link. The major difference being the placement of the jar files in the domain/domainXX/lib directory.
Here are the application versions I used to get a functional Caucho Quercus PHP implementation running on GlassFish v 2.1
Mac OS X 10.5.6 (Intel x86)
- GlassFish v 2.1 Build 60e ( 2.1 FCS)
- Quercus 3.2.1
- Java(TM) SE Runtime Environment (build 1.6.0_07-b06-146) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-56, mixed mode)
Mac OS X 10.5.6 (PowerPC)
- GlassFish v 2.1 Build 60e ( 2.1 FCS)
- Quercus 3.2.1
- jsr223-api.jar (Project Phobos) Required for Java SE 5.
- Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <session-config> <session-timeout> 30 </session-timeout> </session-config> <description>Caucho Technology's PHP Implementation</description> <servlet> <servlet-name>Quercus Servlet</servlet-name> <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class> <!-- Specifies the encoding Quercus should use to read in PHP scripts. --> <!-- <init-param> <param-name>script-encoding</param-name> <param-value>UTF-8</param-value> </init-param> --> <!-- Tells Quercus to use the following JDBC database and to ignore the arguments of mysql_connect(). --> <!-- <init-param> <param-name>database</param-name> <param-value>jdbc/test</param-value> </init-param> --> <!-- <init-param> <param-name>ini-file</param-name> <param-value>WEB-INF/php.ini</param-value> </init-param> --> </servlet> <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.php</welcome-file> </welcome-file-list> </web-app>
This arrangement will allow you run a large number of applications including XWiki, and Drupal. Unfortunately for me, it can not run phpLDAPadmin which I needed.
5 comments :
How was the performance?
Hi John. Thanks for the report. I've been thinking of ways that GlassFish users with common interests can help each other. In this case with Quercus / PHP. The current thought it that we would create a "home" page in a Wiki for each key technology, assign an owner, and keep it up-to-date.
The performance was quite good, but I am only providing a subjective view. I don't have any numbers to back it up. I would note that it takes a lot less time to load on Glassfish than Apache 2.
Again that is subjective.
pelegri, I think that is a great idea. I would add my notes and remarks to it.
Where were you planning on adding it? Perhaps on the Aquarium?
Great post - thanks! I've performed a similar install with the latest Glassfish and Quercus which seems to be running very well and doesn't require the php to be encased in a war. :o) I wrote the up the details here: http://www.greatwhiteit.com/blog/?p=1
-Garry
Post a Comment