這次沒想到本來很簡單的php編譯,沒想到遇到那么多問題.再此記錄一下.
1.php5.5編譯安裝主要有一個難點,就是GD庫的問題,因為php5.5的GD庫必須是2.1以上的版本哦
原來都是用的gd2.0的
gd2.1的版本這個版本估計太新了,很少人用,網上編譯的文章都沒有
還要注意的是這個資源需要翻牆才能下載,翻牆工具自備
不能安正常方式編譯,而且編譯GD庫之前要安裝許多依賴lib-jpng等,一個個裝吧,最后一個應該是freetype
這些都不是很麻煩,耐點心都能裝好.
然后GD庫按照傳動的./configure 然后make時候居然報錯,
找了好久,居然換成cmake . 然后make & make install 居然就可以了,無語不知道是為什么反正成功
因為資料很少.
后來找到一個 ./configure --with-freetype=/usr/local/freetype --with-zlib=/usr/local/zlib --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg --prefix=/usr/local/gd2
這個是可以的,如果不行刪除后重新制定就可以了 make clean估計也可以,因為之前編譯了很多遍
最后記錄一下這次php編譯的參數

./configure --prefix=/usr/local/php5.5 \ --with-config-file-path=/usr/local/php5.5/etc \ --with-config-file-scan-dir=/usr/local/php5.5/etc/conf.d \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-pdo-sqlite=shared \ --with-zlib=/usr \ --with-zlib-dir=/usr \ --with-mhash \ --with-kerberos \ --with-ldap \ --with-ldap-sasl \ --with-curl \ --with-curlwrappers \ --with-gettext \ --with-gd=/usr/local/gd2 \ --with-freetype-dir=/usr/local/freetype \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-xsl=/usr \ --with-openssl-dir=/usr \ --with-openssl \ --with-iconv \ --with-gettext \ --with-pear=/usr/local/php5.5 \ --with-pcre-regex=/usr \ --with-pcre-dir=/usr/local/pcre \ --with-mcrypt=/usr \ --with-xmlrpc \ --with-libxml-dir=/usr/lib64 \ --enable-ftp \ --enable-mbstring \ --enable-soap \ --enable-sockets \ --enable-fpm \ --with-fpm-user=www-data \ --with-fpm-group=www-data \ --enable-opcache \ --enable-zip \ --disable-debug \ --enable-calendar \ --enable-static \ --enable-libxml \ --enable-zend-multibyte \ --enable-exif \ --enable-inline-optimization \ --enable-xml \ --enable-session --enable-ctype --enable-mbregex \ --enable-gd-native-ttf --enable-pcntl \ --enable-bcmath --enable-shmop --enable-sysvsem \ --enable-wddx
編譯了很多遍都報GD函數找不到,最后直接cp /usr/local/gd2/lib64/ 里面的所有文件到/usr/local/lib /usr/local/lib64,后居然
神奇的通過了.
如果ubuntu下因為開啟ldap編譯后報這樣的錯誤
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_pvt_opt_on@@OPENLDAP_2.4_2'
/usr/bin/ld: note: 'ber_pvt_opt_on@@OPENLDAP_2.4_2' is defined in DSO /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 so try adding it to the linker command line
/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2: could not read symbols: Invalid operation
搜索了好久在老外的一篇文章中終於找到解決辦法
-Run your configure command
-edit Makefile
-Find the line that starts with "EXTRA_LIBS ="
-Add the following to the end of the line " -llber"