php5.5安装笔记
这次没想到本来很简单的php编译,没想到遇到那么多问题.再此记录一下.
1.php5.5编译安装主要有一个难点,就是GD库的问题,因为php5.5的GD库必须是2.1以上的版本哦
原来都是用的gd2.0的
gd2.1的版本这个版本估计太新了,很少人用,网上编译的文章都没有
还要注意的是这个资源需要FQ才能下载,FQ工具自备
不能安正常方式编译,而且编译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编译的参数
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
./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"