星期一, 4月 30, 2012

[IIS7] IIS7 執行 php專案以及phpMyAdmin

本篇記綠在IIS7上面執行php與phpMyAdmin的安裝心得。
最後可以正確在IIS7上架php的專案(可正常連接mysql),
但目前IIS7執行phpMyAdmin專案在載入mysql.dll模組會錯誤,尚無解Orz~

安裝環境: 
Win7


前置工作:
Appserv安裝apache, php, phpmyadmin


如何在IIS7上執行php設定步驟

接著打開IIS管理工具

Step1:選擇 處理常式對應

Step2:接著點擊 新增模組對應

Step3:
在 要求路徑中 輸入 *.php

類型下拉 選擇 FastCgiModule

執行檔選擇 php5安裝目錄下的 php-cgi.exe

接著名稱取個 PHP for FCGI 即可

點確定,接著將剩餘的步驟都點確定即可完成設定。

Step4:
接著,請到php5安裝目錄下,把php.ini-recommended 改為 php.ini

Step5:
重新啟動www服務,即可運作PHP


無法成功執行phpMyadmin錯誤排除


錯誤一:
PHP Warning:  Unknown: open(C:\Windows\TEMP\\sess_l50k8lcfco58ogqqktdhar4332, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0

解決方法:
step1:新建一個存放session的目錄C:\temp\phpsessions
step2:幫 C:\temp\phpsessions 加入以下權限
  • IUSR
  • IIS_IUSRS
  • Network Service 
step3:編輯php.ini檔案
  • 找到session.save_path屬性,將他的值設為C:\temp\phpsessions後存檔
  • uncomment以下的extension
    • extension=php_mysql
    • extension=php_gd2.dll
    • extension=php_mbstring.dll 
step4:在Default web site的預設文件,加入index.php
step5:編輯config.sample.inc.php(phpMyAdmin的資料夾內),有幾個屬性要修改:

  •  $cfg[‘blowfish_secret’] = ‘trainsignal1111TST’;
  • User for advanced features有二個值要改


    1. $cfg['Servers'][$i]['controluser'] = 'pma'
    2. $cfg['Servers'][$i]['controlpass'] = ' trainsignal '
  • uncomment all of Advanced phpMyadmin features
step6:config.sample.inc另存為config.inc.php
step7:打開瀏覽器檢視 http://localhost/phpMyAdmin

錯誤二:

HTTP 錯誤 500.0 - Internal Server Error
C:\AppServ\php5\php-cgi.exe - FastCGI 處理序意外地結束
解決方法:
表示載入未安裝在windows的php extension模組,
請確定php.ini文件內的Windows Extensions以下載入的dll模組是否存在。

錯誤三:無法載入mysql模組
解決方法共有二種:
(1)
  • 查看php.ini內的extension_dir的值有沒有正確指到extension dlls路徑:
    • 本例:C:\AppServ\php5\ext
  • 複製以下檔案到C:\Windows\System32下(資料顯示fast cgi不用複製以下檔案)
    • libmysql.dll,php5isapi.dll,php5ts.dll
(2)
把你的 PHP5 安裝路徑及底下的 ext 目錄加到系統的 PATH 環境變數下。 
如:PATH=C:\AppServ\php5\;C:\AppServ\php5\ext
這樣就不用複製檔案,而且 PHP 版本更新也不成問題。 

Reference:
http://www.trainsignal.com/blog/iis-7-install-fastcgi-php
http://www.trainsignal.com/blog/install-phpmyadmin-on-iis7-and-server-2008
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis/#EnableFastCGI
http://note.jhpeng.com/2012/02/iis7-php53.html
http://leeycnote.blogspot.com/2010/06/apachex64phpx64mysqlx64_24.html

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails