Running PHP on a Java container

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Running PHP on a Java container - Presentation Transcript

    1. II PHP-PB Meeting Tournament of 15 Minutes 07/03/2009
    2. Tournament of 15 minutes Little Boy Developer I'm trying to win a little elePHPant
    3. Tournament of 15 minutes How to win of little squirrel?
    4. Running PHP on a Java container QUERCUS
    5. What's Quercus? Quercus is Caucho Technology's 100% Java implementation of PHP 5 released under the Open Source GPL license
    6. What's I need? A Java container Glassfish * Tomcat Download the last version of library
    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. 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. 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. Now I can do my project... MYPROJECT.WAR/ - WEB-INF - lib: quercus.jar, resin-util.jar, javamail-141.jar - web.xml - index.php
    11. On index.php... <?php phpinfo(); ?> ... my output is
    12. The little elePHPant jump...
    13. Importing Java class with PHP
    14. Class IWantALittleElePHPant.java package info.netinho.tournament; public class IWantALittleElePHPant { private String iwantalittleelephant; public IWantALittleElePHPant() { this.iwantalittleelephant = \"I want a little elePHPant!\"; } public String get() { return this.iwantalittleelephant; } public static String getStatic() { return \"I want a little elePHPant!\"; } }
    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. And the output... I want a little elePHPant!
    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. Thank you! http://netinho.info/

    + netinhoteixeiranetinhoteixeira, 8 months ago

    custom

    810 views, 0 favs, 0 embeds more stats

    This was the 15 minutes tournament at II PHP-PB Mee more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 810
      • 810 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 13
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories