teknoradio.nl channel 3 by ravers for ravers

Shopping Cart

Friends

Adding PHP support to SailFin

Finally it is now a breeze to enable PHP on SailFin. PHP is a server-side scripting language which has quite a large user base in the web development community. PHP code is embedded in HTML and sent to a webserver for interpretation. The webserver therefore needs to run a PHP interpreter. The guys from Caucho Technology have made a 100% Java implementation of such an interpreter, called Quercus. Quercus is delivered as a .war file and as such it can be ran on any Java application server – such as SailFin.

Quercus is not only an interpreter, it also offers PHP extensions allowing you to call server-side Java code directly from within your PHP script. The Caucho website offers some documentation on how to do that; this opens interesting possibilities on SailFin. You can now use JSR289 functionality directly from within PHP. For example, if you’re running a PHP guestbook, you could extend it to include SIP dial-out functionality.

To deploy Quercus, download the latest version, open the SailFin admin console, select Applications, then Web Applications, then Deploy… and point to the Quercus .war file you just downloaded. If all goes well, your admin console should look something like this:

To verify that your PHP engine is working, point your browser to the default PHP script that comes with the Quercus interpreter: http://localhost:8080/quercus-3.1.6/ (your HTTP port or Quercus version might of course be different). You should get the following screen:

Now go try out some PHP applications on your SailFin server; for example, you could run your own MediaWiki on your local SailFin server! To do so, download the latest MediaWiki distribution and unzip it in the Quercus interpreter root directory (assuming your running the default out-of-the-box domain called domain1):

Of course you will need to complete other steps, depending on the type of PHP application you’re developing or trying out. In the case of MediaWiki, you will need to setup a MySql server and create the appropriate JDBC objects in SailFin. I might describe how to do that in a later blog.