|
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.
Contents
Downloading the Software
First, download and install the software required:
- Download Web Server 7.0 Update 1.
See the collection of documentation and a helpful blog by Sun engineer Ajay Acharya: Sun Java System Web Server 7.0 Installation Demo.
- Download the Quercus PHP WAR file, currently in Beta.
Creating a Sample Configuration
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.
- Go to the Web Server installation directory, for example:
cd C:\Program Files\Sun\WebServer7
- Start the Administration Server. Type:
C:\Program Files\Sun\WebServer7> admin-server\bin\startserv.bat
- Create a configuration and instance. Below are the command lines and output.
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
|
Web Server creates a directory called https-quercus in your Web Server installation directory.
Deploying the Web Application
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.
Acknowledgment
Special thanks to Caucho Technology's Quercus team for making the Quercus PHP WAR file available for download.
References
- Sun Java System Web Server
- Dynamic content technologies
- Caucho Quercus
- Related documents
|
Sriram Natarajan is a member of the Sun Java System Web Server development team. Since 2004, he has been working on Web Server releases. Before that, Sriram worked on the development of Sun Java System Active Server Pages. His blog addresses a variety of technical topics.
|
Marina Sum is a staff writer for Sun Developer Network. She has been writing for Sun since 1989, mostly in the technical arena. Marina blogs on Sun products, technologies, events, and publications.
|
|