Introduction: PHP occupies a place in web development, whether it is a small scale web application or a large web site like Yahoo. PHP and Java have always been in the form of competitors, and if we can use both PHP and Java at the same time, this competing situation could change. By combining PHP flexibility with the power of Java, developing web apps may not be as complex as it is today and will become a pleasure. This article describes a way to combine PHP and Java with PHP integration kits to enable IBM's Open-source server WebSphere application Server Community Edition to support PHP scripts. By learning this article, the reader can grasp the principle of PHP integration Kit, the sample in this paper illustrates the feasibility of this technique.
Background and working principle
PHP is a very popular scripting language in Web application development. When we use PHP as a server-side script (this article will not discuss running PHP on the command line and writing desktop applications in PHP), you need to run on a Web server such as the Apache HTTP server or Microsoft IIS. Although we can configure both PHP and JSP support on the Apache HTTP server, we need to forward PHP and JSP requests to the appropriate PHP engine or Java application Server, and there is no relationship between the PHP script and the JSP code. Nor can you mix PHP scripts and JSP code in an HTML page. With PHP integration Kit for Websphere®application Server (IS), Community Edition (CE), we can integrate PHP scripts into java™2 Enterprise Edit Ion (Java EE) application, for example, through the container Managed security (CMS) to control access to PHP scripts, through the was CE Management console to install/update the PHP application, but also through the JavaScript filter technology To modify HTML pages that contain PHP scripts. You can find the latest information on this project on the IBM Alphaworks Web site, which currently supports Windows and Linux, but is now not available in the product environment.
The PHP Integration Kit forwards PHP script requests to the PHP engine by configuring FASTCGI filter in the servlet container. PHP Integration Kit provides a launcher to invoke the PHP engine. It should be noted that PHP integration Kit did not rebuild a PHP engine, but instead needed to take advantage of the existing PHP engine (which is easier to understand because the PHP engine is provided and maintained by Php.net). If you have more than one version of the PHP engine installed in your system, you can configure the PHP engine in the Web Deployment description file Web.xml. Figure 1 illustrates the lifecycle of a PHP script in WASCE.
Figure 1. The life cycle of PHP scripts in WASCE
Deployment: To enable PHP integration kit to run PHP scripts, PHP applications need to be packaged and deployed in a special way. Here's a detailed description of the steps that, in short, are packaged in a way that requires compliance with the Java Enterprise Application War model.