安装Discuz

1.下载Discuz 版本文件
http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

2.下载PHP
http://windows.php.net/downloads/releases/php-5.6.9-Win32-VC11-x64.zip

把里面文件的php.ini-development 更名为php.ini

Uncomment下列语句

 extension_dir = "ext"

可以用命令检测是否能用php -v

如果报错php.exe is not a valid win32 application,那就是这个php是32位版本,而OS是64位

3.将里面的upload文件放在IIS下,convert to application,选择Framework v4版本的application pool

双击“处理程序映射”,“添加模块映射”,把php-cgi.exe加进去

做一个test.php文件,里面的内容是<?php phpinfo(); ?>,然后在浏览器里打localhost/..../text.php
这样可以测试是否可以显示php页面

http://localhost/Discuz/install/index.php
之后浏览网页提示不允许目录浏览,点击Default Web Site->目录浏览->启用
然后浏览网页提示FastCGI进程意外退出

进入PHP目录,运行PHP -v , 提示找不到msvcr110.dll64
尝试下载位版本的dll,但放进C:Windowswindows/system32或者C:WindowsSysWOW64依然会报错,后来下载vcredist_x64,安装好后就可以了

计算机中丢失 msvcr110.dll 怎么办
http://jingyan.baidu.com/article/4f7d57129fa86e1a201927de.html


Visual C++ Redistributable for Visual Studio 2012 Update 4
http://www.microsoft.com/zh-cn/download/confirmation.aspx?id=30679


4进入安装界面后,会提示一系列目录不存在以及mysql不支持

对于列出的目录,全部加上IUSR和IIS_IUSRS用户,并且给予他们全部权限。注意不起作用的话,关掉选项卡,再次尝试刷新。

5.下载mysql
http://dlsw.baidu.com/sw-search-sp/gaosu/2015_03_23_16/bind1/12585/mysql_installer_community_V5.6.21.1_setup_12585_BDdl.exe

得到的是绿色安装版本,按下面链接改my.ini,之后运行mysqld -install 就会安装了
注意如果安装成功后报错连接不了端口,这是因为有个mysql的服务没有启动,启动了就可以telnet上了

http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22-winx64.zip

MySQL绿色版的安装(mysql-5.6.22-win32.zip)

http://www.cnblogs.com/freeton/p/4264829.html



6.回到安装界面,会发现还是说不支持mysql
此时应当检查php.ini里面的驱动有没有uncomment掉
extension=php_mysql.dll
extension=php_mysqli.dll

如果还是不行,则重启IIS服务器,应该是OK的了

7.IIS6下运行Discuz,忽略那些php5iapi.dll,要用fastcgi方法
WIN2003+IIS6+FastCGI+PHP5.4.30的安装配置
http://hanbaohong.iteye.com/blog/1273205

Microsoft IIS 5.1 and IIS 6.0 Configuring IIS to process PHP requests
http://www.php.net/manual/en/install.windows.iis6.php

a.首先是安装fcgisetup_1.5_rtw_x64.msi
安装后会在C:WINDOWSsystem32inetsrv目录下多出了5个文件fcgiconfig.js,fcgiext.dll,fcgiext.ini,fcgilicense.rtf,fcgireadme.htm

这个时候在IIS6的"WEB服务扩展"里就多出了一个FastCGI Handler , 设为允许

b.CGI and FastCGI settings in php.ini

fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0

c.Configuring FastCGI extension to handle PHP requests

cscript %windir%system32inetsrvfcgiconfig.js -add -section:"PHP" ^
-extension:php -path:"C:PHPphp-cgi.exe"

d.Application -> Properties -> Configuration->Add
可执行文件填写C:WINDOWSsystem32inetsrvfcgiext.dll

扩展名填写.php。

动作->限制为GET,HEAD,POST。

Documents -> Add index.php


e.测试

用文本写一段测试代码:
<?php
phpinfo();
?>

保存为index.php,名字随便取,只要后缀是.php就可以。把index.php放到根目录下,我这里是C:Inetpubwwwroot,然后在浏览器中输入http://localhost/index.php就可以得到返回的信息了。

8.DX3.2 、PHP7出错set_magic_quotes_runtime()

http://localhost/discuz/install/

The website cannot display the page

 

PHP Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in D:Inetpubwwwrootdiscuzinstallindex.php:12

Stack trace:

#0 {main}

thrown in D:Inetpubwwwrootdiscuzinstallindex.php on line 12

从PHP 5.4开始,set_magic_quotes_runtime()已经被弃用,从PHP 7.0开始set_magic_quotes_runtime()已经被移除
对于 Discuz! X3.2,即删除install/index.php的以下代码

@set_magic_quotes_runtime(0);

 9.DX3.2 、PHP7出错Call to undefined function mysql_escape_string()

PHP Debug

No. File Line Code
1 index.php 130 require(%s)
2 forum.php 56 discuz_application->init()
3 source/class/discuz/discuz_application.php 66 discuz_application->_init_setting()
4 source/class/discuz/discuz_application.php 686 loadcache(Array)
5 source/function/function_core.php 702 table_common_syscache->fetch_all(Array)
6 source/class/table/table_common_syscache.php 63 discuz_database::field(%s, Array)
7 source/class/discuz/discuz_database.php 271 discuz_database::quote(Array)
8 source/class/discuz/discuz_database.php 185 discuz_database::quote(%s, true)
9 source/class/discuz/discuz_database.php 177 break()
这个问题比较烦人,php7已经不支持这个mysql_escape_string ,一开始,我按上面列出的文件找那个function,可是找不到,然后搜索整个文件夹,替换成mysql_real_escape_string,但重新安装后依然显示同样的错误。
好吧,那就换成php5.6,结果更离奇了,打开后什么都没有,也没有错误消息。
最后,幸好有人实现了Discuz3.2对PHP7的兼容,直接下载就好了

X3.2针对PHP7的兼容版本-测试ing
http://www.discuz.net/thread-3699198-1-1.html

https://github.com/branchzero/discuz-x32-php7/releases


注意,如果PHPAdmin用IE8或者IE8以下的浏览器,版面会乱掉。不要紧,换个浏览器就行了。


原文地址:https://www.cnblogs.com/sui84/p/6777051.html