Saturday, January 31, 2009

PHP In GlassFish

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 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 -
  1. Extract the contents of the archive downloaded from the Quercus Caucho website
  2. 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
  3. Open the file glassfish/domains/domain1/config/default-web.xml and add the following lines

    <servlet-name>Quercus Servlet</servlet-name>

    <servlet-name>Quercus Servlet</servlet-name>

  4. Though the above lines of code seem to very complex, they can be simply interpreted as follows -

    The first set of code indicates that there is a servlet available under the name Quercus Servlet and the second set of code 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.


Anonymous said...

Glassfish current versions have PHP support and they are available for download.

Sandip said...

Hi...I am sandip...I was there at Sun Tech Days...were u there too? I met lot of CAs but forgot their names (coz I have a bad memory)...

Anonymous said...

...please where can I buy a unicorn?

Anonymous said...

unicorns in boxes of 6 can be picked up at your local unicorn seller

sarah taylor said...

Thanks for sharing informative article!!! Your article helped me a lot to understand the importance of PHP Training Center in Chennai to secure lucrative job in web design and development industry.