| By Sriram Natarajan and Marina Sum, October 9, 2007 |
Sun Java System Web Server runs on all major operating systems and supports numerous dynamic content technologies, such as Java Servlet, JavaServer Pages, JavaServer Faces, Active Server Pages, PHP, ColdFusion, Netscape API, CGI, and Ruby on Rails, for developing Web applications. Its latest release, Sun Java System Web Server 7.0 Update 1 (henceforth, Web Server), is available for free download.
You can take advantage of the Java EE 5 platform-compliant Web container in Web Server to build reliable and scalable Web applications that are in demand from large enterprises nowadays. With Caucho Technology's Quercus, an open-source, Java technology implementation of PHP 5, you can also leverage that Web container for developing highly scalable PHP applications.
This article describes how to configure Quercus as a Web application within the Web container in Web Server to run PHP-based applications, such as Drupal and MediaWiki.
Note: Type each of the command lines in this article on one line even though, because of screen-width constraints, some of them wrap to the next line.
| - | Downloading the Software |
| - | Creating a Sample Configuration |
| - | Deploying the Web Application |
| - | Acknowledgment |
| - | References |
First, download and install the software required:
To try out the approach, create a configuration and instance named quercus and deploy it on Web Server. For a demo of the procedure involved in the Web Server Administration Console, see Ajay Acharya's screencast.
Tip: To avoid having the Administration Server ( wadm) prompt you for a password with every command, follow this procedure to save the password and other related information.
To create the configuration and instance on the command-line interface (CLI), do the following:
Note: The file conventions in the following commands are those for the Windows platform.
cd C:\Program Files\Sun\WebServer7 C:\Program Files\Sun\WebServer7> admin-server\bin\startserv.bat C:\Program Files\Sun\WebServer7> bin\wadm.bat create-config --user=admin --password-file=.password --http-port=8084 --server-name=sriramn quercus CLI201 Command 'create-config' ran successfully C:\Program Files\Sun\WebServer7> bin\wadm.bat create-instance --user=admin --password-file=.password --config=quercus sriramn CLI201 Command 'create-instance' ran successfully |
https-quercus in your Web Server installation directory.Now deploy the Quercus PHP Web application (the WAR file) to Web Server either in the Administration Console or with the CLI. To use the CLI, type these two commands:
C:\Program Files\Sun\WebServer7> bin\wadm.bat add-webapp --user=admin --config=quercus --vs=quercus --uri=/php /quercus-3.1.2.war WAR-file-dir
C:\Program Files\Sun\WebServer7> bin\wadm.bat deploy-config --user=admin quercus
Finally, stop and restart the Web Server quercus server instance and you'll be able to access the PHP home page ( index.php) within the Web application: Just go to http://localhost:8084/php/index.php. This welcome page is displayed:
|
You can now configure and run PHP scripts within Web Server. Be sure to create the scripts within your Web application's context root. In our example, the context root is C:\Program Files\Sun\WebServer7\https-quercus\web-app\quercus\php.
Special thanks to Caucho Technology's Quercus team for making the Quercus PHP WAR file available for download.
