Drupal7網站+IIS7.0+PHP+MySql,drupal7iis7.0
1.服務器系統環境
Windows Server 2008 R2 Enterprise 64位操作系統
2.所需軟件
IIS7
PHPManager http://phpmanager.codeplex.com/releases/view/69115
php-5.5.25-Win32-VC11-x64 下載地址:http://windows.php.net/download/
mysql-installer-community-5.5.28.3.msi 下載地址:http://dev.mysql.com/downloads/installer/
Navicat_for_MySQL_10.0.11.0_XiaZaiBa.exe 下載地址:
vcredist_x64.exe(msvcr110.dll)
備注:安裝IIS+PHPManager+PHP教程步驟地址:http://jingyan.baidu.com/article/f0e83a25a86cb022e59101be.html http://blog.csdn.net/zevin/article/details/6928973
3.配置PHP環境
1).下載的包(php-5.5.25-Win32-VC11-x64)直接解壓縮到c:。復制其中的php-development.ini為php.ini
2).打開php.ini文件
3).修改擴展路徑:extension_dir = "c:\php-5.5.25-Win32-VC11-x64\ext" (這裡寫自己的實際路徑,注意:去掉前面的;分號)
4).開啟以下模塊(php_curl.dll php_mysql.dll php_mysqli.dll php_pdo_mysql.dll php_xmlrpc.dll php_curl.dll)
5)修改date.timezone = "Asia/Shanghai"
4.配置MySql環境
1).找到你的mysql目錄下的my.ini配置文件,加入或者修改以下代碼
max_allowed_packet=500M; wait_timeout=288000; interactive_timeout = 288000;
自己看情況更改數值,最後記得重啟你的mysql服務
5.IIS上發布網站
6.通過Navicat_for_MySQL_10軟件創建數據庫,並導入網站數據(通過備份、還原的方式導入數據)
7.修改網站的數據庫鏈接配置
打開,網站根目錄\sites\default\settings.php找到下面代碼
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => '第6步創建的數據庫名稱',
'username' => 'root',
'password' => '****',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
8.浏覽器中訪問發布的網站
9.常見問題(參考網址:http://blog.sina.com.cn/s/blog_5093fd500102vkob.html)
HTTP 錯誤 500.0 - Internal Server Error
E:\Program Files\php\php-cgi.exe - FastCGI 進程超過了配置的活動超時時限
網上一搜,解決方案如下:
使用%WINDIR%\system32\inetsrv\appcmd.exe list config /section:fastcgi /text:*獲得當前配置
CONFIG
CONFIG.SECTION:"system.webServer/fastCgi"
path:"MACHINE/WEBROOT/APPHOST"
overrideMode:"Inherit"
locked:"false"
[system.webServer/fastCgi]
[application]
fullPath:"E:\Program Files\php\php-cgi.exe"
arguments:""
maxInstances:"4"
idleTimeout:"300"
activityTimeout:"30"
requestTimeout:"90"
instanceMaxRequests:"200"
protocol:"NamedPipe"
queueLength:"1000"
flushNamedPipe:"false"
rapidFailsPerMinute:"10"
[environmentVariables]
使用appcmd set config -section:system.webServer/fastCgi /[fullPath='E:\Program Files\php\php-cgi.exe'].activityTimeout:600
將超時時限改成10分鐘(最大可以設到1小時)
可是報錯:
ERROR ( message:找不到帶有標識符“Files\php\php-cgi.exe'].activityTimeout:600”的 SITE 對象。 )
所有搜到的中文網站php-cgi.exe的路徑都沒有空格,但是我的偏偏就有,執行不了。
最後跑到老外的網上找到了解決辦法:%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI "/[fullPath='E:\Program Files\php\php-cgi.exe'].activityTimeout:600"
二、
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\php\php-cgi.exe'].activityTimeout:600
如果還是不行,請查看IIS應用程序池,可以改為默認(DefaultAppPool)。
三、
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\php\php-cgi.exe'].activityTimeout:600
查看當前配置
%windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgi
都是在cmd下運行
也可以在C:\Windows\System32\inetsrv\config\applicationHost.config 進行編輯