升级新版本的时候安装php失败

问答中心分类: PHP升级新版本的时候安装php失败
yflwz asked 4年 ago
原来的服务器安装的版本是2017年1月份的oneinstack版本,昨晚运行uninstall卸了所有软件,然后重新下载最新版本重新安装,服务器是centos6.8 64位,安装的软件有nginx+tomcat7+jdk1.7+mysql5.5+php5.6,编译安装php的时候失败,不知道是哪里的问题?

8 Answers
yflwz answered 4年 ago
上不了图片,重新把故障重现了一下,贴上最后失败的一段代码
/opt/oneinstack/src/php-5.6.36/ext/standard/dns.c:907: undefined reference to `__res_nsearch'
/opt/oneinstack/src/php-5.6.36/ext/standard/dns.c:941: undefined reference to `__dn_skipname'
ext/standard/.libs/dns.o: In function `zif_dns_check_record':
/opt/oneinstack/src/php-5.6.36/ext/standard/dns.c:414: undefined reference to `__res_nsearch'
ext/xmlrpc/libxmlrpc/.libs/encodings.o: In function `convert':
/opt/oneinstack/src/php-5.6.36/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open'
/opt/oneinstack/src/php-5.6.36/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv'
/opt/oneinstack/src/php-5.6.36/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
PHP install failed, Please Contact the author!
Killed
[root@localhost oneinstack]# oneinstackoneinstackoneinstackoneinstackoneinstackoneinstackoneinstackoneinstackStarting php-fpm /etc/init.d/php-fpm: line 57: /usr/local/php/sbin/php-fpm: No such file or directory
failed

yflwz answered 4年 ago
如果是新的操作系统或原来没有安装过老版本oneinstack的情况下,就没有问题,能顺利安装。

oneinstack answered 4年 ago
可能libiconv问题
参考下:https://blog.csdn.net/ikscher/article/details/51009584

yflwz answered 4年 ago
我查看源始php的sh文件,已经加上了-liconv。
    ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
    --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
    --with-fpm-user=${run_user} --with-fpm-group=${run_user} --enable-fpm ${phpcache_arg} --disable-fileinfo \
    --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
    --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
    --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
    --enable-sysvsem --enable-inline-optimization --with-curl=${curl_install_dir} --enable-mbregex \
    --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl=${openssl_install_dir} \
    --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
    --with-gettext --enable-zip --enable-soap --disable-debug $php_modules_options
  fi
  make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}

yflwz answered 4年 ago
最后我把php.sh里面哪几个判断文件不存在的注释去掉就好了。

Alan answered 4年 ago
/root/oneinstack/src/php-7.2.8/ext/gd/libgd/gdkanji.c:349: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/gd/libgd/gdkanji.c:364: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/gd/libgd/gdkanji.c:380: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:2558: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:747: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:771: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:805: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:470: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:504: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1497: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1990: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1993: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1608: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1611: undefined reference to `libiconv_open'
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:868: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:892: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:947: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:951: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:900: undefined reference to `libiconv_open'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1186: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1200: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1318: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1270: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1302: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1462: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1371: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1403: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1459: undefined reference to `libiconv_close'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1446: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_string':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:576: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:585: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:601: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:611: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:995: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1023: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:1137: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:2623: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:2696: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:2695: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/root/oneinstack/src/php-7.2.8/ext/iconv/iconv.c:2579: undefined reference to `libiconv_open'
ext/standard/.libs/dns.o: In function `zif_dns_get_mx':
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:1074: undefined reference to `__res_nsearch'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:1085: undefined reference to `__dn_skipname'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:1092: undefined reference to `__dn_skipname'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:1105: undefined reference to `__dn_expand'
ext/standard/.libs/dns.o: In function `php_parserr':
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:447: undefined reference to `__dn_expand'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:588: undefined reference to `__dn_expand'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:594: undefined reference to `__dn_expand'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:768: undefined reference to `__dn_expand'
ext/standard/.libs/dns.o:/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:511: more undefined references to `__dn_expand' follow
ext/standard/.libs/dns.o: In function `zif_dns_get_record':
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:937: undefined reference to `__res_nsearch'
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:971: undefined reference to `__dn_skipname'
ext/standard/.libs/dns.o: In function `zif_dns_check_record':
/root/oneinstack/src/php-7.2.8/ext/standard/dns.c:416: undefined reference to `__res_nsearch'
ext/xmlrpc/libxmlrpc/.libs/encodings.o: In function `convert':
/root/oneinstack/src/php-7.2.8/ext/xmlrpc/libxmlrpc/encodings.c:65: undefined reference to `libiconv_open'
/root/oneinstack/src/php-7.2.8/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv'
/root/oneinstack/src/php-7.2.8/ext/xmlrpc/libxmlrpc/encodings.c:93: undefined reference to `libiconv_close'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
PHP install failed, Please Contact the author! 
我的也是,没解决

oneinstack answered 4年 ago
新安装服务器是否有问题?

yflwz answered 4年 ago
新服务器安装是没有问题的