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 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

<servlet>
<servlet-name>Quercus Servlet</servlet-name>
<servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
<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>

  • 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.

9 comments:

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.

Rahul said...

Hello Admin, thank you for enlightening us with your knowledge sharing. PHP has become an inevitable part of web development, and with proper PHP training in Chennai, one can have a strong career in the web development field.

Srishthi B said...

Hello Admin, thank you for enlightening us with your knowledge sharing. PHP has become an inevitable part of web development, and with proper PHP training in Chennai, one can have a strong career in the web development field. We from Fita provide PHP course in Chennai with the best facilitation. Any aspiring students can join us for the best PHP training institute in Chennai.

Diya Patel said...

Best SQL Query Tuning Training Center In Chennai This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

murali karthik said...

Thanks for your informative post!!! After completing my graduation, i am confused whether to choose web design as my career. Your article helped me to make a right choice. PHP Training in Chennai