在安装php过程中make install时候的报错:
Installing PEAR environment: /usr/local/php/lib/php/
/home/sysadmin/zhaoyj/software/php-5.2.17/sapi/cli/php: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
make[1]: *** [install-pear-installer] Error 127
make: *** [install-pear] Error 2
但是在/usr/local/lib下却能找到libiconv.so.2
[root@XKWB5510 php-5.2.17]# find / -name libiconv.so.2
/usr/local/lib/libiconv.so.2
/home/sysadmin/zhaoyj/software/libiconv-1.13.1/lib/.libs/libiconv.so.2
先尝试着创建一下软连接
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
使用此方法的时候需要考虑到在configure时的支持选项--with-iconv-dir=/usr/local,所以创建连接这方式可能是无效的
解决方法是将/usr/local/lib路径添加到/etc/ld.so.conf文件中,
然后用ldconfig命令加载,再重新输入make install命令就可以了
[root@XKWB5510 php-5.2.17]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
php编译成功了
[root@XKWB5510 php-5.2.17]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI binary: /usr/local/php/bin/
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Structures_Graph- installed: 1.0.3
[PEAR] XML_Util - installed: 1.2.1
[PEAR] PEAR - installed: 1.9.1
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php/include/php/ext/pdo/