II PHP-PB Meeting

    Tournament of 15 Minutes

    07/03/2009
Tournament of 15 minutes

    Little Boy Developer

    I'm trying to win a little elePHPant
Tournament of 15 minutes

    How to win of little squirrel?
Running PHP on a Java container

           QUERCUS
What's Quercus?

    Quercus is Caucho Technology's 100% Java
    implementation of PHP 5 released under
    the Open Sour...
What's I need?

    A Java container
       Glassfish *
       Tomcat


    Download the last version of library
What really matters?

    WEB-INF/lib/quercus.jar
    WEB-INF/lib/resin-util.jar
    WEB-INF/lib/javamail-141.jar
    WEB-...
On web.xml – Part 1 of 2
<!-- start: enabling quercus //-->
<servlet>
  <servlet-name>Quercus Servlet</servlet-name>
  <se...
No arquivo web.xml – Parte 2 de 2
...
<welcome-file-list>
  <welcome-file>index.php</welcome-file>
</welcome-file-list>
<!...
Now I can do my project...

    MYPROJECT.WAR/
       - WEB-INF
         - lib: quercus.jar, resin-util.jar,
             ...
On index.php...
<?php
 phpinfo();
?>


 ... my output is
The little elePHPant jump...
Importing Java class with PHP
Class IWantALittleElePHPant.java

       package info.netinho.tournament;

       public class IWantALittleElePHPant {

  ...
File want.php

       <?php
       import info.netinho.tournament.IWantALittleElePHPant;

       $want = new IWantALittleE...
And the output...


                    I want a little
                      elePHPant!
References

    Quercus - http://quercus.caucho.com/
    Glassfish - http://www.glassfish.org/
    NetBeans - http://www.n...
Thank you!




             http://netinho.info/
Upcoming SlideShare
Loading in...5
×

Running PHP on a Java container

3,005

Published on

This was the 15 minutes tournament at II PHP-PB Meeting with a elePHPant as prize. Now this little elePHPant is eating nuts at my home.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,005
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Running PHP on a Java container

  1. 1. II PHP-PB Meeting Tournament of 15 Minutes 07/03/2009
  2. 2. Tournament of 15 minutes Little Boy Developer I'm trying to win a little elePHPant
  3. 3. Tournament of 15 minutes How to win of little squirrel?
  4. 4. Running PHP on a Java container QUERCUS
  5. 5. What's Quercus? Quercus is Caucho Technology's 100% Java implementation of PHP 5 released under the Open Source GPL license
  6. 6. What's I need? A Java container Glassfish * Tomcat Download the last version of library
  7. 7. What really matters? WEB-INF/lib/quercus.jar WEB-INF/lib/resin-util.jar WEB-INF/lib/javamail-141.jar WEB-INF/web.xml
  8. 8. On web.xml – Part 1 of 2 <!-- start: enabling quercus //--> <servlet> <servlet-name>Quercus Servlet</servlet-name> <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class> <!-- to enable the database <init-param> <param-name>database</param-name> <param-value>java:comp/env/jdbc/JNDIDBMAPPED</param-value> </init-param> --> </servlet> <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> <!-- end: enabling quercus //--> ...
  9. 9. No arquivo web.xml – Parte 2 de 2 ... <welcome-file-list> <welcome-file>index.php</welcome-file> </welcome-file-list> <!-- start: data source reference //--> <!-- <resource-ref> <res-ref-name>jdbc/MYDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> --> <!-- end: data source reference //-->
  10. 10. Now I can do my project... MYPROJECT.WAR/ - WEB-INF - lib: quercus.jar, resin-util.jar, javamail-141.jar - web.xml - index.php
  11. 11. On index.php... <?php phpinfo(); ?> ... my output is
  12. 12. The little elePHPant jump...
  13. 13. Importing Java class with PHP
  14. 14. Class IWantALittleElePHPant.java package info.netinho.tournament; public class IWantALittleElePHPant { private String iwantalittleelephant; public IWantALittleElePHPant() { this.iwantalittleelephant = quot;I want a little elePHPant!quot;; } public String get() { return this.iwantalittleelephant; } public static String getStatic() { return quot;I want a little elePHPant!quot;; } }
  15. 15. File want.php <?php import info.netinho.tournament.IWantALittleElePHPant; $want = new IWantALittleElePHPant(); echo $want->get(); ?> File want-static.php <?php $want = java_class(“info.netinho.tournament.IWantALittleElePHPant”); echo $want->getStatic(); ?>
  16. 16. And the output... I want a little elePHPant!
  17. 17. References Quercus - http://quercus.caucho.com/ Glassfish - http://www.glassfish.org/ NetBeans - http://www.netbeans.org/ Others references HeidiSQL - http://www.heidisql.com/
  18. 18. Thank you! http://netinho.info/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×