Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> Web 伺服器

解決 phpMyAdmin 提示「無法載入 mcrypt 擴展」的完整方案

編輯:Web 伺服器

錯誤現象

phpMyAdmin 開啟時顯示:「無法載入 mcrypt 擴展,<br />請檢查 PHP 配置」,導致相關加密功能無法使用。

常見原因與解決步驟

1. MySQL 服務未啟動

檢查「服務」中 MySQL 相關服務是否為「已啟動」狀態,若無請手動啟動或設為自動。

2. 缺少 libmcrypt.dll

現象: 系統目錄 C:\Windows\System32 缺少 libmcrypt.dll。
解決: 從 PHP 安裝目錄複製 libmcrypt.dll 至 C:\Windows\System32,重啟 Web 服務 (Apache/IIS)。

3. php.ini 未啟用 mcrypt 擴展

位置: C:\Windows\php.ini (或 PHP 安裝目錄下的 php.ini)。
修改: 尋找 ;extension=php_mcrypt.dll,移除前面的分號:

extension=php_mcrypt.dll

儲存後重啟 Web 服務。

4. MySQL 目錄權限不足

確保 MySQL 資料目錄權限設定為:

  • Administrators:完全控制
  • SYSTEM:完全控制
  • Users:讀取與執行
  • 移除其他不必要的使用者權限

修改後重啟 MySQL 服務與 Web 服務,建議重啟伺服器。

5. 關鍵步驟:設定 PHPRC 環境變數 (常被忽略)

若以上方法皆無效,請新增系統環境變數指定 PHP 設定檔路徑:

  1. 右鍵「我的電腦」→「內容」→「進階」→「環境變數」
  2. 「系統變數」區點選「新增」
  3. 變數名稱:phprc
  4. 變數數值:C:\php (PHP 實際安裝路徑)
  5. 確定並重啟伺服器

此步驟讓 PHP 正確讀取 php.ini,解決擴展載入失敗的根本問題。適用於 Windows Server 2003 + IIS + PHP 5 + MySQL 5 等環境,XP 同理。

Copyright © Windows教程網 All Rights Reserved