tomcat 下安裝 MantisBT

sekihin發表於2017-07-21

環境

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

根據嚮導進行安裝。

 

相關文章