Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2783473
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: Java

2012-03-12 14:55:01

This guide shows how to install and run PHP applications like , , as Tomcat 6 web applications. And how to install PHP 5.x for all existing web applications.

Download and install Java, Tomcat and PHP
  • Use a graphical packet installer to install . Or download JavaBridge.war, which contains an embedded PHP binary.
  • Download and install or above.
  • Download and install .
Install a PHP web application into Tomcat
  1. Copy the PHP web application or the demo JavaBridge.war to the Tomcat webapps directory.
  2. Wait two seconds until Tomcat has loaded the web application.
  3. Browse to and to see the PHP info page.
  4. Rename the file directory, for example to , and download and install your PHP application to this directory.
  5. Browse to the name of your web application, for example , to run it from your internet browser.
PHP support for all existing Tomcat web applications

If you want to enable PHP for all of your web applications, move the Java libraries from the local web application folder to the Tomcat library folder and edit the Tomcat web configuration as follows:

  1. Stop Tomcat.
  2. Move the libraries JavaBridge.jar, php-servlet.jar and php-script.jar from the webapps/JavaBridgeTemplate621/WEB-INF/lib directory over to the tomcat lib directory.
  3. Edit the Tomcat conf/web.xml. Add the following 9 lines marked with a +:

    <web-app xmlns=... >

    + php.java.servlet.ContextLoaderListener
    + PhpJavaServletphp.java.servlet.PhpJavaServlet
    +

    + PhpCGIServletphp.java.servlet.fastcgi.FastCGIServlet
    + prefer_system_php_execOn
    + php_include_javaOff
    +

    + PhpJavaServlet*.phpjavabridge
    + PhpCGIServlet*.php
    ...

    </web-app>
  4. Start Tomcat again. Now you can add PHP scripts to tomcat.
  5. Add a PHP test file
    < ?php require_once("java/Java.inc");
    echo java("java.lang.System")->getProperties(); ?>
    to some web context, for example "examples", and browse to
  6. Check the process list using the Unix/Linux or Windows task manager. There should be 5 php-cgi FastCGI executables waiting for requests from Java.
  7. Please see our for more information how to set up a load balancer or how to create a distributable PHP/Java web application.
阅读(1926) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~