操作步骤
0、备份现在正常工作的bugzilla使用的数据库;
1、将之前正常运行的bugzilla文件夹放置到httpd.conf中DocumentRoot 所指定的目录;
2、在bugzilla文件夹中localconfig文件中指定新的数据库viatombug和用户viatombug;
3、在mysql中创建用户viatombug,并赋予权限;
4、运行checksetup.pl,bugzilla会创建数据库viatombug;
5、更改bugzilla中的文件
*.cgi 文件中的第一句话 #!/usr/bin/perl -T 改为 #!perl -wT ;
*.pl文件中的第一句话 #!/usr/bin/perl 改为 #!perl -w ;
为此,要用到两个批处理文件:
<span style="font-size:18px;">Replace_CGI.bat</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size:18px;">@echo off</span></span>
<span style="font-size:18px;">echo CGI files replace begin ...
for /f "tokens=1,2,* delims=:" %%i in ('findstr /n .* *.cgi') do (
if %%j==1 (echo #!perl -wT >> %%i.new) else (echo;%%k >> %%i.new)
)
echo Delete original CGI files...
del *.cgi
echo Generate new CGI files...
for /f "tokens=1,2,3 delims=." %%i in (' dir /b ^| findstr "new$" ') do (
ren %%i.%%j.%%k %%i.%%j
)
echo ALL actions done.
</span>
<pre name="code" class="html"><span style="font-size:18px;">Replace_PL.bat</span>
<span style="font-size:18px;">@echo off
echo PL files replace begin ...
for /f "tokens=1,2,* delims=:" %%i in ('findstr /n .* *.pl') do (
if %%j==1 (echo #!perl -w >> %%i.new) else (echo;%%k >> %%i.new)
)
echo Delete original PL files...
del *.pl
echo Generate new PL files...
for /f "tokens=1,2,3 delims=." %%i in (' dir /b ^| findstr "new$" ') do (
ren %%i.%%j.%%k %%i.%%j
)
echo ALL actions done.
</span>
<span style="font-size:18px;">
</span>
以上的批处理文件只能替换与其为同一目录下的文件,而不能替换其他目录的文件。
为此,还有一个批处理文件将所有cgi文件和pl文件列举到指定文件中,以便针对性的放置以上两个批处理文件到指定目录:
<span style="font-size:18px;">ReplaceFileList.bat</span>
<span style="font-size:18px;">
</span>
<span style="font-size:18px;">@echo off
dir /s /b ^| findstr *.cgi > ReplaceFileList.txt
rem 打印空行
echo: >> ReplaceFileList.txt
dir /s /b ^| findstr *.pl >> ReplaceFileList.txt
pause</span>
6、在系统中注册Perl解释器,以便.cgi和.pl文件可以顺利执行,regedit注册表,创建
HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command 的值为 C:\Perl64\bin\perl.exe -T
具体值要更加Perl安装位置确定。
7、配置apache的httpd.conf文件
打开apache的httpd.conf配置文件找到
Options Indexes FollowSymLinks
在最后面添加ExecCGI参数使其可以作为服务器端cgi执行。
Options Indexes FollowSymLinks ExecCGI
找到
#AddHandler cgi-script .cgi
取消注释并在后面加上.pl
AddHandler cgi-script .cgi .pl
8、将步骤0 备份的数据库导入新建的数据库viatombug;
9、打开网址:http://localhost:81/Bugzilla/index.cgi 。
本文严重参考 http://dorole.com/119/ 博文,在此表示感谢!