centos5安裝PHP5時遇到問題

科技小能手發表於2017-11-14

 PHP版本:5.3.1,作業系統:centos5.4

    手動編譯安裝GD,然後在安裝PHP時指定GD安裝路徑,configure通過,make通過,make test無法通過:  

    imagecopyresampled() [ext/gd/tests/imagecopyresampled_basic.phpt] (warn:ing:require_once(skipif_imagetype.inc):failed to open stream:NO such file or directory in /usr/local/php-5.3.1/ext/gd/tests/imagecopyresampled_basic.skip.php on line 3) 

    imagedashedline() [ext/gd/tests/imagedashedline_basic.phpt] (warn:ing:require_once(skipif_imagetype.inc):failed to open stream:No such file or directory in /usr/local/php-5.3.1/ext/gd/tests/imagedashedline_basic.skip.php on line 3)
    imageploygon() [ext/gd/tests/imagepolygon_basic.phpt] (warn:ing:require_once(skipif_imagetype.inc):failed to open stream:NO such file or directory in /usr/local/php-5.3.1/ext/gd/tests/imagepolygon_basic.skip.php on line 3)
    via [ext/pdo_sqlite/tests/common.phpt] 
    SQLite PDO Common:Bug #34630 (inserting streams as LOBs) [ext/pdo_sqlite/tests/bug_34630.phpt] (warn:XFAIL section but test passes) 
    via [ext/pdo_sqlite/tests/common.phpt]
    SQLite PDO Common:Bug #34630 (inserting streams as LOBs) [ext/pdo_sqlite/tests/bug_34630.phpt] (warn:XFAIL section but test passes)
 
    重新編譯第一次:按照PHP的PAQ所說,安裝PHP時不指定GD安裝路徑。
     configure通過,make無法通過:
     collect2: ld returned 1 exit status
     make: *** [sapi/cli/php] Error 1
 
      重新編譯第二次:編譯時指定GD路徑,對GD庫的其它選項使用 –with-jpeg-dir=/usr/local –with-zlib-dir –with-png-dir=/usr/local –with-freetype-dir=/usr/local –with-gd=/usr/local/gd。
 configure通過,make通過,make test時解決了前三個問題,只出現SQLite2 PDO和SQLite PDO的錯誤
 
      重新編譯第三次:因為phpmyadmin提示“無法載入mcrypt擴充套件,請檢查您的PHP配置,所以重新編譯PHP,加入–with-mcrypt選項,結果在編譯PHP時遇到了不少問題。
     1、Configure: error: libjpeg.(also) not found.
     2、Configure: error: libpng.(also) not found.
     解決:yum install libjpeg-devel  
                yum install libpng-devel
    3、error: freetype.h not found.
    解決:缺少freetype-devel,yum install freetype-devel
    4、遇到configure: error: mcrypt.h not found. Please reinstall libmcrypt.而libcrypt已經安裝,在網上查了一下資料,發現是缺少libmcrypt-devel。
     解決:yum install libmcrypt-devel
 
   重新編譯第四次:遇到:
   /usr/bin/ld: cannot find -lltdl
   collect2: ld returned 1 exit status
   make: *** [libphp5.la] Error 1
   解決:錯誤原因是缺少libltdl。
   yum install libtool-ltdl libtool-ltdl-devel
 
  最終編譯時指定了以下引數,禁用SQLite2 PDO和SQLite PDO,問題全部解決:
./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/share/mysql –with-jpeg-dir=/usr –with-png-dir=/usr –with-freetype-dir=/usr –with-gd –enable-exif –enable-mbstring –enable-soap –with-mcrypt –with-curl =/usr/local/curl –with-libxml-dir=/usr/local/libxml2 /bin/xml2-config –without-pdo-sqlite –without-sqlite 
本文轉自 li_qinshan 51CTO部落格,原文連結:http://blog.51cto.com/share/265798


相關文章