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

PHP 啟用 mcrypt 擴展:需 libmcrypt.dll 支援的完整步驟

編輯:關於伺服器

錯誤現象

PHP 啟動報錯:Unable to load dynamic library 'php_mcrypt.dll' - The specified module could not be found,實為缺少依賴 libmcrypt.dll。

解決步驟

  1. 編輯 php.ini,搜尋 ;extension=php_mcrypt.dll,移除前置分號:
    extension=php_mcrypt.dll
  2. 從 PHP 安裝包目錄 (或 php5 目錄) 複製 libmcrypt.dll 至系統目錄:
    C:\Windows\System32\ (64 位系統亦放此處,或 SysWOW64)。
  3. 重啟 IIS (iisreset) 或 Apache 使擴展生效。

驗證

php -m | findstr mcrypt
# 或建立 phpinfo.php 瀏覽確認 mcrypt 區塊出現

補充說明

  • PHP 7.2+ 已棄用 mcrypt,建議改用 openssl 或 sodium 擴展。
  • 若使用 PHP 5.6/7.0/7.1 維護舊專案,此法有效。
Copyright © Windows教程網 All Rights Reserved