GlassFish is an App Server written in Java. So GlassFish does most of its work with the help of Java Servlets.
GlassFish does not have built-in support for PHP. Actually it can support PHP if a Java implementation of PHP exists for GlassFish. This was made available by Quercus Caucho at http://quercus.caucho.com/. Download the binaries and source of Quercus from the site.
Assuming that GlassFish is installed and its directory path is represented as "glassfish", proceed with the following steps -
- Extract the contents of the archive downloaded from the Quercus Caucho website
- Copy quercus.jar, resin-util.jar and script-10.jar from the WEB-INF/lib directory which is obtained from extracting the zip file to glassfish/lib directory
- Open the file glassfish/domains/domain1/config/default-web.xml and add the following lines
- The first set of configuration indicates that there is a servlet available under the name Quercus Servlet and the second set of configuration indicates that the servlet is to be run whenever a file with php extension is encountered
That’s it, restart GlassFish and it should be now be compatible to understand PHP.