7 Replies Latest reply on Aug 14, 2009 1:17 PM by Peter Johnson

    Php on JBoss?

    Sachin Parnami Newbie

      Hi All,

      I am looking for a guide where i can use Php on JBoss is it possible to do with JBoss?

      Please guide :)

      Sachin Parnami

        • 1. Re: Php on JBoss?
          Peter Johnson Master

          Have a look at these:


          Also, I have had some luck with deploying the Quercus module from Resin (http://www.caucho.com/resin-3.0/quercus/) to JBoss AS, but I still haven't gotten around to fixing the Quercus code to enable database access from within JBoss AS.

          • 2. Re: Php on JBoss?
            Gary Driggs Newbie

            I'm glad I found this thread as I'm unable to access MySQL with Quercus even as a default datasource under JBoss AS. I'll have a look at Native and Web in the mean time.

            much thanks,

            • 3. Re: Php on JBoss?
              Peter Johnson Master

              What do you mean by 'Native' and 'Web'? If you mean JBoss Web or JBoss Native, neither of those will work either.

              The issue is that Quercus translates database connection requests into a call to the corresponding JDBC driver, but then attempts to cast a Driver object to a DataSource. Works OK if the Driver object also implements the DataSource, but doesn't work so well if ti does not, and in MySQL it does not.

              When you run Quercus within Resin, there is a Resin-specific class that overrides the connection mechanism and looks up a data source from Resin's connection pool and provides that, and then the cast to a DataSource passes.

              As a quick fix kludge, I have considered replacing the connection code with a JNDI lookup of the datasource; of course I'd have to change the my PHP code to pass the datasource JNDI name to the mysql_connect() function. As more correct solution would be to provide a JBoss-specific wrapper for the connection mechanism, like what Resin supplies.

              • 4. Re: Php on JBoss?
                Peter Johnson Master

                Correction. I was using PostgreSQL when I ran into the issues described above. Looking at the Quercus code for MySQL it looks like it uses the DataSource class built into the MySQL JDBC driver if you do not specify another driver class. I'll have to look at this a little more to see what the issues are with MySQL.

                • 5. Re: Php on JBoss?
                  Peter Johnson Master

                  OK, it appears that I was using an older version of Quercus. I just now downloaded Quercus 3.2.1 from http://quercus.caucho.com/ and my PHP apps now work with both PostgreSQL and MySQL on JBoss AS 5.1.0. I still want to provide a mechanism to make use of the connection pools, though. Something for my "todo" list.

                  • 6. Re: Php on JBoss?
                    Gary Driggs Newbie

                    Have you tried Quercus under JBoss Web? I ask because WordPress doesn't work for me with Web's build of PHP but Quercus lists it as one of their target apps.


                    • 7. Re: Php on JBoss?
                      Peter Johnson Master

                      I have not tried Quercus under JBoss Web. However, I am currently using Quercus under the server/web configuration of AS 5.1.0 (the web config is basically JBoss Web plus connector support). I did run into one issue. I had this in my *-ds.xml file:


                      This caused an error due to a missing dependency:

                      ** NOT FOUND Depends on 'jboss:service=invoker,type=jrmp' **

                      I had to remove that line from my *-ds.xml file and then add a resource-ref to my web-xml and add in a jboss-web.xml file to get the datasource to be looked up in the ENC.


                      <?xml version="1.0" encoding="utf-8"?>
                      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                       <description>Caucho Technology's PHP Implementation</description>
                       <servlet-name>Quercus Servlet</servlet-name>
                       <servlet-name>Quercus Servlet</servlet-name>

                      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">