安装编译php的时候,configure跟make都很顺利,可是到了make install的时候就出现错误,编译了那么多的东西,还是头一回见到make install的时候才出错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@sbear php-5.2.9]# make install
Installing PHP SAPI module:       cgi
Installing PHP CGI binary: /usr/local/php-cgi/bin/
Installing PHP CLI binary:        /usr/local/php-cgi/bin/
Installing PHP CLI man page:      /usr/local/php-cgi/man/man1/
Installing build environment:     /usr/local/php-cgi/lib/php/build/
Installing header files:          /usr/local/php-cgi/include/php/
Installing helper programs:       /usr/local/php-cgi/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php-cgi/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php-cgi/lib/php/
/root/php-5.2.9/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory
make[1]: *** [install-pear-installer] Error 127
make: *** [install-pear] Error 2
 

明明在/usr/local/mysql/lib里边也是有 libmysqlclient.so.15文件的,就是一直报错,找了很久才发现是mysql属于自行安装,lib库没在系统环境变量中,需要加上去。 export LD_LIBRARY_PATH=”/usr/local/mysql/lib:$LD_LIBRARY_PATH” 加上这句后在去安装编译就ok了。