编译php时可能出现的错误以及解决办法
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
错误1: configure:error:xml2-config ont found. Please check your libxml2 installation.
解决: yum install -y libxml2-devel
错误2: configure:error: Cannot find OpenSSL's <evp.h>
解决: yum install -y openssl-devel
错误3: configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决: yum install -y libmcrypt-devel
错误4: 在编译php-5.2.10 with php-5.2.10-fpm时,有这样的错误:
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:291: undefined reference to `SSL_set_fd'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:293: undefined reference to `SSL_connect'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:287: undefined reference to `SSL_CTX_free'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:295: undefined reference to `SSL_shutdown'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
解决办法:
1. yum install -y openssl openssl-devel libevent libevent-devel
2. make clean 然后重新 ./config --with-prefix=/usr/local/php ... (你以前的选项)然后在最后面加上 --with-libevent
3. make
错误1: configure:error:xml2-config ont found. Please check your libxml2 installation.
解决: yum install -y libxml2-devel
错误2: configure:error: Cannot find OpenSSL's <evp.h>
解决: yum install -y openssl-devel
错误3: configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决: yum install -y libmcrypt-devel
错误4: 在编译php-5.2.10 with php-5.2.10-fpm时,有这样的错误:
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:291: undefined reference to `SSL_set_fd'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:293: undefined reference to `SSL_connect'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:287: undefined reference to `SSL_CTX_free'
/usr/local/src/php-5.2.10/ext/ftp/ ftp.c:295: undefined reference to `SSL_shutdown'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
解决办法:
1. yum install -y openssl openssl-devel libevent libevent-devel
2. make clean 然后重新 ./config --with-prefix=/usr/local/php ... (你以前的选项)然后在最后面加上 --with-libevent
3. make
none