12 Replies Latest reply on Aug 29, 2012 5:48 AM by Sushant Gulati

    Does Jboss support PHP?

    Vikram Prabhakar Newbie

      I wanted to know if Jboss supports PHP.
      I was trying to install WordPress MU (PHP blogging application).
      so wanted to know if Jboss supports PHP?
      are there any steps to configure PHP with Jboss?


      Thanks in advance

        • 1. Re: Does Jboss support PHP?
          Peter Johnson Master

          Yes, it does, but not out-of-the-box. See http://www.jboss.org/jbossweb/modules/php/index.html.

          Basically, you need to more things:
          1) JBoss Native - download and install the one specific to your operating system
          2) The PHP module - download and configure as indicated in the above link.
          3) You must package your PHP app within a WAR file. The PHP module download comes with a demo PHP WAR file, use that as a template.

          • 2. Re: Does Jboss support PHP?
            Vikram Prabhakar Newbie

            Hi Peter,
            I followed the steps given in the below link
            http://www.samaxes.com/php-tutorial/jbossweb.php
            I was able to run php script with Jbossweb server.

            I wanted to know how I can run php script using Jboss application server.
            I am very naive to Jboss. Could you please give me the steps to be followed to run PHP script on JBoss ?
            I have downloaded the Jboss Native. I dont know how to install it!.
            After Extracting the Jboss Native, I get two folders.
            1.bin
            2.licenses
            I also tried to follow the steps in the link http://www.jboss.org/jbossweb/modules/php/index.html .
            to configure PHP module.
            But There is no Jbossweb.sar in the deploy folder. How should i install PHP module on jboss application server?
            Please help.
            Thanks in advance

            • 3. Re: Does Jboss support PHP?
              Peter Johnson Master

              To install JBoss Native, copy the contents of the bin directory to the jboss_home/bin directory.

              For JBossAS 4.2.2, the jboss-web.sar has been replaced by jboss-web.deployer.

              • 4. Re: Does Jboss support PHP?
                Vikram Prabhakar Newbie

                Hi Peter ,
                Thanks for the reply.
                I am explaining the steps that I tried, to make PHP script run on JBoss Application Server on WINDOWS XP Operating System.

                1. Download & Extract Jboss Application server on to a local drive(say C:\ drive ).
                2. Download & Extract php5servlet-windows-i586-SP1.zip(the PHP module) to C: drive.
                3. Created a folder “php5� under C:
                4. copied c:\php5servlet-windows-i586-SP1\PHP\* to c:\php5.
                (now “php5� folder has a “bin� folder inside it).
                5. Made a copy of the C:\php5\bin\php.ini-recommended to %WINDIR%\php.ini. (%WINDIR% is nothing but C:\WINDOWS)
                6. Opened %WINDIR%\php.ini and changed extension_dir value to c:/php5/bin/ext/.
                7. Edited the server\default\deploy\jboss-web.deployer/server.xml
                (Added the following lines in the server.xml)

                8. Edited the server\default\deploy\jboss-web.deployer\conf/web.xml to work with the php servlet .
                (Added the following lines in web.xml)

                <servlet-name>php</servlet-name>
                <servlet-class>org.jboss.web.php.Handler</servlet-class>
                <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
                </init-param>
                <load-on-startup>6</load-on-startup>


                <servlet-name>phps</servlet-name>
                <servlet-class>org.jboss.web.php.Highlight</servlet-class>

                <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>
                10. Added one line in the <welcome-file-list> element:<welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.php</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                </welcome-file-list>
                11. I have set the 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;
                And .\server\default\deploy\jboss-web.deployer, has jbossweb-extras.jar
                12. I have created a simple php script <?php phpinfo(); ?> in index.php file and have copied it under .\server\default\deploy\ROOT.war

                I am getting the following error:
                java.lang.UnsatisfiedLinkError: Can't find SAPI class, no libphp5servlet in java.library.path

                please note:
                I have installed Java Native. I have downloaded java Native “jboss-native-2.0.4-windows-x86-ssl�.(is that the correct native ??)I copied the contents of folder “bin� to Jboss_home/bin.
                Could you please guide me in running php script on Jboss Application Server?
                Where is libphp5servlet? I dint find any libphp5servlet in PHP module or Java Native.

                Thanks in advance.
                vikram

                • 5. Re: Does Jboss support PHP?
                  Vikram Prabhakar Newbie

                  for the step number 7 :
                  The line added for server.xml is




                  I forgot to add that line in the above post. :)

                  • 7. Re: Does Jboss support PHP?
                    Vikram Prabhakar Newbie

                    <Listener className="org.jboss.web.php.LifecycleListener"
                    '/>

                    • 8. Re: Does Jboss support PHP?
                      Peter Johnson Master

                      Use the Code button when posting XML text - select the text and click Code. It will place [code ] ... [ /code ] brackets around the text.

                      The error message "Can't find SAPI class, no libphp5servlet in java.library.path" is using the Linux name of the file. On Windows the name is php5servlet.dll and you can find it in the PHP download at PHP/bin. You should copy that file to jboss_home/bin/native. And make sure that c:/php/bin is in your PATH.

                      • 9. Re: Does Jboss support PHP?
                        Vikram Prabhakar Newbie

                        Hi Peter,
                        http://www.jboss.com/index.html?module=bb&op=viewtopic&t=125437&postdays=0&postorder=asc&start=20
                        By refering to the above thread, I was able to run php script on Jbossas.

                        I just copied the php5servlet.dll into the bin folder of Jboss AS. & now it is working. There is some problem with the package names.
                        The JBoss people have to update the php5servlet.dll for Windows in the PHP module.

                        Thanks a lot peter

                        Regards,
                        vikram

                        • 10. Re: Does Jboss support PHP?
                          Newbie

                          Hi

                           

                          I am trying to run PHP on JBoss As 7.1.

                           

                          I tried following the steps mentioned above however am stuck at the AS configurations as in 7.1 we do not have jboss-web.deployer.

                           

                          Can someone please help me to configure PHP for JBoss AS 7.1?

                           

                          Regards

                          Himani Aggarwal

                          • 11. Re: Does Jboss support PHP?
                            Peter Johnson Master

                            I suspect that the php5servlet.dll mechanism will not work in 7.x (but it might, I haven't tried it). I would instead try Quercus. See if this page, or the pages linked to, helps:

                            https://community.jboss.org/message/613791

                            • 12. Re: Does Jboss support PHP?
                              Sushant Gulati Newbie

                              Hi Peter

                              After going through this thread (and a few others) as suggested by you I succesfully deployed quercus-4.0.25.war (by unzipping it) on my JBoss AS7 running on Windows 7.

                              I am able to hit the php pages when I paste them in "\jboss-as-7.1.1.Final\standalone\deployments\quercus.war".

                               

                              Further my target is to deploy OWA (Open Web Analytics) which is built using PHP on the same server as my web application is running on, which happens to be JBoss AS7.

                               

                               

                              The problem what I am facing is when I try to install OWA it generates a config file (inside quercus.war) with the values I have entered in the installation form.Now in the second step OWA tries to read these values but all it reads is blank (empty) values.

                              After comparing this newly generated config file with the same config file generated over wamp server (during installation of OWA over wamp) what I found is that there is difference in the struture of both the generated files. The one generated thru JBoss over Quercus didn't have any new line. All config file entry was in a single line whereas the config file generated over wamp had multiple new lines.

                              When I replace the config file generated using Quercus over JBoss with the config file generated on wamp, it works fine.

                               

                              As per my understanding what I am interpreting is that due to some encoding difference this is happening.

                              Is there a difference between the encoding which quercus renders with the one PHP module runs on?