| http://www.devx.com | Printed from http://www.devx.com/webdev/Article/32110/1954 |
|
Deploy PHP Pages and JSP Pages Within the Same Web Context
You need to integrate PHP content and JSP content in a single Web application. Should you convert the PHP to JSP, or vice versa? A better question is why choose. You can deploy both in the same Web application context.
by
Kyle Gabhart
|
||||
n an ideal world, businesses would select one technology platform and deploy it throughout their entire enterprises. In the real world, information systems are composed of a mix of operating systems, platforms, and application environments. To add to this complexity, the systems nearly always are a blend of modern and legacy.
For application developers, this can lead to a rather daunting challenge, particularly when two disparate technologies need to coexist within the same application. An example of this is side-by-side deployment of PHP-based content and JSP-based content within the same Web application. This 10-Minute Solution offers one approach for deploying PHP and JSP pages within the same Web context.
|
Solution MethodologyAs with any problem, several solutions are available. The solutions for this problem can be grouped into the following three major categories:
The approach this solution takes is the second category: Tomcat serves as the primary request processor while Apache serves as the secondary supporting processor. (Figure 1 presents a simple visualization of this approach.) If your preference is more along the lines of the first category outlined above, it is simple enough to adapt this approach accordingly.
At the bottom of Apache’s HTTP config file (/$APACHE_INSTALL/conf/httpd.conf), you should find the following block of code:
Below this section, create a
As previously described, you could easily tailor the above approach to fit a variant methodology by changing the
|
Deploying the ApplicationOnce you have properly configured the environment, it is time to package and deploy the Web components. Packing and deploying your Java Web application is no different when you have Apache deployed in front of Tomcat. The directory structure and location of config files (WEB-INF/web.xml) does not change. The difference comes when storing the PHP and CGI files alongside your Java Web application.
Additionally, deploying PHP pages and CGI scripts inside the normal directory structure enables them to share the same support files (CSS, JS, images, etc.) with the Java Web content. Also, this model provides an intuitive view into the Web application’s structure and how URIs are likely to be resolved. Calling PHP/CGI content from Java Web components (and vice versa) becomes much simpler.
This solution has offered one viable means of integrating PHP/CGI content with JSP/Servlet content as a part of a single deployment Web context. Some situations demand that you bite the bullet and choose one technological path, but in this case, you really can have both.
|
| DevX is a division of Jupitermedia Corporation © Copyright 2007 Jupitermedia Corporation. All Rights Reserved. Legal Notices |