[PHP]安裝PHP在Win7 IIS


這篇要說明如何使用IIS來架PHP的網站(雖然通常大家都用阿帕契來架,但是最近的"你欠囉"風波~~~冷  哈)

1.首先要先安裝IIS,這是廢話也是基本的,但是有個地方一定要注意必須勾選,如下圖

這次我下載的是PHP 5.6.8,VC11 x64 Thread Safe (2015-Apr-16 01:46:22)這個版本(最好是下載Thread Safe版本)

3.解壓縮下載後的壓縮檔並放在 C:\PHP\ 資料夾
4.複製資料夾中的 php.ini-production 檔案,並將檔名改為php.ini
5.用記事本開啟剛剛所複製改檔名的那個檔案php.ini,並找到下列的設定參數,移除註解(去除";"分號就代表去除註解了)並將值改同下方設定參數的值,完成後儲存設定。

memory_limit = 256M
post_max_size = 128M
extension_dir = "C:\PHP\ext"
upload_tmp_dir = "C:\PHP\upload"
upload_max_filesize = 128M
max_execution_time = 600
max_input_time = 600
max_input_vars = 2000
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
extension=php_curl.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_gd2.dll
extension=php_ldap.dll
extension=php_mysqli.dll

session.save_path = "C:\PHP\session"
session.use_cookies = 1



6.建立"upload" and "session" 這兩個資料夾於 C:\PHP\ 資料夾中.你可以選擇你要的資料夾名稱去設定,但是php.ini的參數也要跟著調整

7.設定時域,也是在php.ini中
date.timezone = "Asia/Taipei"
選擇你所在的城市所屬的時域預設定.
設定完php.ini後,到命令提示字元中執行下列指令,已進行php安裝
stallation is successful, run the following from the command line prompt:
C:\PHP>php -i


可參考下列連結,找到完整的時域設定值
full list of possible date.timezone values on PHP.net website.

配置IIS對PHP的設定

1.開啟IIS管理員,於主機上之選擇處理常式對應。如下圖

2.選擇新增模組對應

3.新增模組,設定如下


Note
If you do not see "FastCgiModule" in the "Modules:" drop-down list then it means that the module is not registered or not enabled. To check if FastCGI module is registered open the IIS configuration file %WINDIR%\windows\system32\config\applicationHost.config and check that the following line is present in <globalModules> section:
<add name="FastCgiModule" image="%windir%\System32\inetsrv\iisfcgi.dll" />
Also, in the same file, check that the FastCGI module is added to the <modules> section:
<add name="FastCgiModule" />


則完成設定。

另外記得站台的預設文件要調整為index.php或你想要的首頁名稱




參考網址:http://www.web-site-scripts.com/knowledge-base/article/AA-00495/0/PHP-installation-on-IIS7-IIS7.5-and-IIS8.html

留言

這個網誌中的熱門文章

[Excel]將圖片放置於儲存格中

[電腦軟體]偵測遠端電腦的網路 Port是否開啟

[軟體]AUTOCAD關於開啟圖面時,字型找不到,而要手動指定成 chineset.shx 字型檔問題