php7编译安装

wget http://cn2.php.net/distributions/php-7.0.0.tar.gz
tar xvf php-7.0.0.tar.gz
cd php-7.0.0
./configure  --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www  --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo

若出现如下错误
ext/gd/libgd/.libs/gdkanji.o: In function `do_convert’:
/root/php-7.0.0/ext/gd/libgd/gdkanji.c:349: undefined reference to `libiconv_open’
/root/php-7.0.0/ext/gd/libgd/gdkanji.c:364: undefined reference to `libiconv’
/root/php-7.0.0/ext/gd/libgd/gdkanji.c:380: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor’:
/root/php-7.0.0/ext/iconv/iconv.c:2557: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen’:
/root/php-7.0.0/ext/iconv/iconv.c:755: undefined reference to `libiconv_open’
/root/php-7.0.0/ext/iconv/iconv.c:779: undefined reference to `libiconv’
/root/php-7.0.0/ext/iconv/iconv.c:813: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl’:
/root/php-7.0.0/ext/iconv/iconv.c:474: undefined reference to `libiconv’
/root/php-7.0.0/ext/iconv/iconv.c:508: undefined reference to `libiconv’
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode’:
/root/php-7.0.0/ext/iconv/iconv.c:1505: undefined reference to `libiconv_open’
/root/php-7.0.0/ext/iconv/iconv.c:1998: undefined reference to `libiconv_close’
/root/php-7.0.0/ext/iconv/iconv.c:2001: undefined reference to `libiconv_close’
/root/php-7.0.0/ext/iconv/iconv.c:1616: undefined reference to `libiconv_close’
/root/php-7.0.0/ext/iconv/iconv.c:1619: undefined reference to `libiconv_open’
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr’:
/root/php-7.0.0/ext/iconv/iconv.c:876: undefined reference to `libiconv_open’
/root/php-7.0.0/ext/iconv/iconv.c:900: undefined reference to `libiconv’
/root/php-7.0.0/ext/iconv/iconv.c:955: undefined reference to `libiconv_close

则编辑Makefile文件
找到
EXTRA_LIBS = -lcrypt -lz -lcrypt -lrt -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lssl -lcrypto -lcurl -lxml2 -lz -lm -lssl -lcrypto -lfreetype -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lssl -lcrypto -lcrypt
在最后添加 -liconv
然后

make && make install

此条目发表在笔记分类目录,贴了, 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注