Hanumant’s Java Workshop

Turbo Charged Java Development!

Firing Up LAMP Update 2

It has been a long time since I investigated this. Here is a quick recap of what happened while working on this earlier: I tried installing Quercus 3.1.3 on Resin 3.0.24 and the sample programs worked fine. Then I tried installing phpBB3, (which was at RC6 stage) and ran into a bug in Quercus which stalled the installation. I googled the issue and found that other people also encountered the same. Folks at Caucho mentioned on their forum that they were working on this issue. Since all of the pieces involved were in beta/non-production stage, I wasn’t too interested persuing this further.

Well, situation has now changed. phpBB3 has been released as a production version and Caucho folks have fixed the issue in Resin 3.1.4. So I decided to give it a try again and the following are my finding/observations.

1. Installing Quercus

Quercus is implemented as a servlet and is bundled in quercus.jar. It also depends on resin-util.jar and script10.jar  Important thing is that all these jar files are already bundled with Resin and are present in <resin>/lib directory. So there is no explicit “installation” of Quercus as such. It is already there. For other app server, these files should be added to their lib folder.

Since Quercus is exposed as a servlet, any webapp that wishes to serve phps, must configure QuercusServlet to service .php requests. This is done by putting the following entry in any webapp’s web.xml file:

   <servlet>
     <servlet-name>Quercus Servlet</servlet-name>
     <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>

    <!– 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/phpbb3</param-value>
    </init-param>

  </servlet>

  <servlet-mapping>
    <servlet-name>Quercus Servlet</servlet-name>
    <url-pattern>*.php</url-pattern>
  </servlet-mapping>

As you can see, I have also configured a database connection that Quercus will use. The free version of Quercus cannot use arbitrary database connections from php script. Regardless of the connection parameters specified in php code, connection specified by this entry is used.  In this case, I have specified a JDBC connection in conf/resin.conf file and mapped it to jdbc/phpbb3.

         <database>
           <jndi-name>jdbc/phpbb3</jndi-name>
           <driver type=”com.mysql.jdbc.Driver”>
             <url>jdbc:mysql://localhost:3306/phpbb3</url>
             <user>abc</user>
             <password>abcpass</password>
            </driver>
            <prepared-statement-cache-size>8</prepared-statement-cache-size>
            <max-connections>20</max-connections>
            <max-idle-time>30s</max-idle-time>
          </database>
 

This  completes the configuration required to use Quercus.

2. Installing phpBB3

I just exploded the phpBB3 distribution in resin\webapps\phpbb3 folder and created web.xml file (web.xml for phpbb3) containing the entries made in step 1, in its WEB-INF folder . That’s it.

I started up resin server and access http://localhost:8080/phpbb3 I got the phpbb3 installation screen, followed the prompts and every thing went smooth. No issues. After installation, I was able to create and access forums, topics, and posts. I must say that at this point I haven’t checked out all the functionality of phpBB3.

So overall, everything seems to be working fine. I will now play with this set up and try to integrate it with some JEE application.

January 31, 2008 - Posted by | Java

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: