相比起用套件管理員 (如 yum, apt-get) 安裝 PHP, 編譯 PHP 源碼較需要較多步驟, 最常見的問題出在套件相依性上。但由於編譯源碼安裝可以自訂各種設定, 所以還是很多情況需要編譯源碼安裝的。
以下會列出在編譯 PHP 時常見的報錯及解決方法。
報錯:
1 2 3 |
checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution |
解決方法:
# yum install bzip2-devel
報錯:
1 2 3 4 5 |
checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/ |
解決方法:
# yum install curl-devel
報錯:
1 2 3 4 5 6 7 8 |
checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found. checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found. |
解決方法:
# yum install libpng-devel
報錯:
1 2 3 4 |
checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir= configure: error: freetype.h not found. |
解決方法:
重新編譯 PHP, 並加上以下參數:
–with-xpm-dir=/usr
報錯:
1 2 |
checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found. |
解決方法:
# yum install libXpm-devel
報錯:
1 2 3 4 |
checking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution |
解決方法:
# yum install sqlite-devel
報錯:
1 2 3 4 5 6 7 |
checking whether to enable UCD SNMP hack… yes checking for default_store.h… no checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information. |
解決方法:
# yum install net-snmp-devel
報錯:
1 2 3 4 5 |
checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution |
解決方法:
# yum install libxslt-devel
報錯:
1 |
configure: error: xml2-config not found. Please check your libxml2 installation. |
解決方法:
# yum install libxml2-devel