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

CentOS 安裝 PHP GD 擴展庫支援

編輯:Linux 教學

問題背景

CentOS 預設 LAMP 環境的 PHP 未包含 GD 圖形庫,導致驗證碼、圖表生成等功能失效。

最簡單解法

# 線上安裝 PHP-GD 擴展包
yum -y install php-gd

# 重啟 Apache 生效
service httpd restart

驗證安裝

php -m | grep gd
# 輸出 gd 表示載入成功

相關檔案位置

  • 設定檔:/etc/php.d/gd.ini(CentOS 採用模組化 ini 目錄)
  • 擴展模組:/usr/lib/php/modules/gd.so

原理說明

CentOS 將 GD 等擴展獨立打包為 php-gd RPM,透過 /etc/php.d/*.ini 機制自動載入,無需手動編輯 php.ini,極大簡化擴展管理。

Copyright © Windows教程網 All Rights Reserved