Install JBoss Web 1.0.1 GA + PHP 5.1.6

Table of contents

Introduction

JBoss Web Server is an enterprise ready web server designed for medium and large applications, based on Tomcat.
JBoss Web Server provides organizations with a single deployment platform for Java Server Pages (JSP) and Java Servlet technologies, PHP, and CGI. It uses a genuine high performance hybrid technology that incorporates the best of the most recent OS technologies for processing high volume data, while keeping all the reference Java specifications.

Requirements

Download and install Sun's JDK.

Download & Unpack

  1. Download the JBossWeb Win32 zipped archive [ 27 Mb ]
  2. Download the native Win32 PHP module archive [ 8 Mb ]

Extract the archives

  1. Extract jbossweb-1.0.1.GA-windows-i686.zip to the root of your C: drive (i.e. C:\jbossweb-1.0.1.GA)
  2. Extract php5servlet-windows-i586-SP1.zip to the root of your C: drive (i.e. C:\php5servlet-windows-SP1-i586)
  3. Move the folder C:\php5servlet-windows-i586-SP1\PHP to C:\php5
  4. Make a copy of the file C:\php5\bin\php.ini-recommended to C:\%WinDir%\php.ini
  5. Open C:\%WinDir%\php.ini with a text editor and change extension_dir value to "C:/php5/bin/ext/".
    If you want to use PHP short tag <? you need to change short_open_tag value to On

Configure the PHP servlet

server.xml

Open the file C:\jbossweb-1.0.1.GA\server\default\deploy\jbossweb.sar\server.xml and uncomment the following line

        <Listener className="org.apache.catalina.servlets.php.LifecycleListener"/>
    

you may modify the default port the server will be listening to, here on port 8080

        <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
           redirectPort="8443" xpoweredBy="true"/>
    

web.xml

Open the file C:\jbossweb-1.0.1.GA\server\default\deploy\jbossweb.sar\conf\web.xml and uncomment the servlets (.php & .phps) mappings

        <servlet-mapping>
            <servlet-name>php</servlet-name>
            <url-pattern>*.php</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>phps</servlet-name>
            <url-pattern>*.phps</url-pattern>
        </servlet-mapping>
    

add the <welcome-file>index.php</welcome-file> line in the welcome file list

        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>index.php</welcome-file>
        </welcome-file-list>
    

Check your Windows Environment Variables

JAVA_HOME
<PATH_TO_YOUR_JDK_INSTALLATION>
PHP_HOME
C:\php5
PATH
%PATH%;%JAVA_HOME%\bin;%PHP_HOME%\bin;%PHP_HOME%\bin\ext

Time to run!

  1. Create a file named test.php in the folder C:\JBossWeb\server\default\deploy\jbossweb.sar\ROOT.war
  2. Edit the created file with your favorite editor and add the following code
                    <?php
                        phpinfo();
                    ?>
                
  3. The file C:\jbossweb-1.0.1.GA\bin\run.bat will run the server within a console. Check for any error message!
  4. et voilĂ , check the installation via the JMX-CONSOLE or via http://localhost/test.php!

you can use C:\jbossweb-1.0.1.GA\bin\service.bat to setup JBossWeb as a windows service.

if you plan to deploy a php webapp, you'll need to pack it in a regular .war file/folder. JBoss will deploy it like a java webapp.