tomcat 下安装 MantisBT

环境

OS:win8.1 up1 64bit

tomcat :9.0.0 64bit

php: php-7.1.7-nts-Win32-VC14-x64.zip

postgres: postgresql-9.5.3-1-windows.exe

软件:mantisbt-2.5.1.zip

 

① 安装posgressql

 

② 将php解压到tomcat的根目录下,将文件夹名字改为php

把php.exe所在的路径加入到path中。

  将php.ini-development 复制一份。改名php.ini

 

③  更改php.ini

;extension_dir = "ext" 

↓

 extension_dir = "ext" 

;extension=php_pgsql.dll

↓

extension=php_pgsql.dll

;cgi.force_redirect  = 1

↓

cgi.force_redirect  = 0

 

④  在tomcat\webapps\ROOT\WEB-INF 下新建一个mantisbt的文件夹

解压mantisbt到tomcat\webapps\ROOT\WEB-INF\mantisbt

 

⑤ 修改tomcat/conf/server.xml添加以下内容

<Context docBase="ROOT/WEB-INF/mantisbt/css" path="/mantisbt/css" />
<Context docBase=" ROOT/WEB-INF/mantisbt/js" path="/mantisbt/js" />

 

<Host name="localhost"  appBase="webapps"
    unpackWARs="true" autoDeploy="true">

    <Context docBase="ROOT/WEB-INF/mantistbt/css" path="/mantistbt/css" />
    <Context docBase="ROOT/WEB-INF/mantistbt/js" path="/mantistbt/js" />

</Host>

 

⑥ 修改tomcat/conf/context.xml文件

<Context ><Context privileged="true">

 

⑦ 修改tomcat/conf/web.xml文件

在<web-app>中加入

<servlet> 

    <servlet-name>php</servlet-name> 
    <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> 
    <init-param> 
      <param-name>clientInputTimeout</param-name> 
      <param-value>200</param-value> 
    </init-param> 
    <init-param> 
      <param-name>debug</param-name> 
      <param-value>0</param-value> 
    </init-param> 
    <init-param> 
      <param-name>executable</param-name> 
      <param-value>C:\tomcat\php\php-cgi.exe</param-value> 
    </init-param> 
    <init-param> 
        <param-name>passShellEnvironment</param-name> 
        <param-value>true</param-value> 
    </init-param> 
    <init-param> 
      <param-name>cgiPathPrefix</param-name> 
      <param-value>WEB-INF/mantisbt</param-value> 
    </init-param> 
     <load-on-startup>5</load-on-startup> 
</servlet> 

<servlet-mapping> 
    <servlet-name>php</servlet-name> 
    <url-pattern>/mantisbt/*</url-pattern> 
</servlet-mapping> 

 

⑧ 重启tomcat服务


⑨在webapps\ROOT\WEB-INF\mantisbt 下下面新建一个test.php

里面的内容为:

<?php phpinfo();?> 

 

打开IE,输入网址:

http://localhost:8080/mantisbt/test.php

输入网址

http://localhost:8080/mantisbt/install.php

根据向导进行安装。