1. 需要使用yum源自动安装的软件:
yum -y install autoconf bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel zlib* zlib-devel openssl openssl-devel pcre-devel gd gd-devel kernel keyutils patch perl perl-devel perl-ExtUtils-Embed kernel-headers mpfr cpp glibc glibc-devel libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5 krb5-devel zlib-devel libXpm* libvpx libjpeg libjpeg-devel libpng libpng-devel zlib libXpm libXpm-devel t1lib libt1-devel freetype freetype-devel libpng* libpng-devel libpng-devel php-common php-gd ncurses* ncurses-devel libtool* libtool-libs patch glibc glibc-devel glib2 glib2-devel krb5 krb5-devel libevent libevent-devel libidn libidn-devel nss_ldap openldap openldap-clients openldap-devel openldap-servers openssl openssl-devel pspell-devel net-snmp* net-snmp-devel libxml2* libxslt* libgeoip* gmp* readline-devel
2.nginx编译安装参数:
./configure --user=nginx --group=nginx --with-select_module --with-poll_module --with-threads --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_xslt_module=dynamic --with-http_image_filter_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail --with-mail=dynamic --with-mail_ssl_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-cpp_test_module --with-pcre --with-pcre-jit --with-md5-asm --with-sha1-asm --with-debug
3.php编译安装参数:
./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-libdir=lib64 --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt=/usr/local/libmcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache
4.configure: error: mcrypt.h not found. Please reinstall libmcrypt
解决方法,执行如下脚本:
#!/bin/bash
basedir=`pwd`
liburl="https://github.com/ralphdc/libmcrypt-2.5.8/archive/master.zip"
hashurl="https://github.com/ralphdc/mhash-0.9.9.9/archive/master.zip"
mcryurl="https://github.com/ralphdc/mcrypt-2.6.8/archive/master.zip"
wget $liburl
unzip master.zip
cd "${basedir}/libmcrypt-2.5.8-master"
chmod 755 -R *
./configure --prefix=/usr/local/libmcrypt
make && make install
sleep 2
cd "${basedir}"
if [ -f master.zip ];then
rm -rf master.zip
fi
wget "${hashurl}"
unzip master.zip
cd "${basedir}/mhash-0.9.9.9-master"
chmod 755 -R *
./configure --prefix=/usr/local/mhash
make && make install
sleep 2
cd "${basedir}"
if [ -f master.zip ];then
rm -rf master.zip
fi
wget "${mcryurl}"
unzip master.zip
cd "${basedir}/mcrypt-2.6.8-master"
export LD_LIBRARY_PATH="/usr/local/libmcrypt/lib:/usr/local/mhash/lib"
export LDFLAGS="-L/usr/local/mhash/lib -I/usr/local/mhash/include/"
export CFLAGS="-I/usr/local/mhash/include/"
chmod 755 -R *
./configure --prefix=/usr/local/mcrypt --with-libmcrypt-prefix=/usr/local/libmcrypt
make && make install
cd "${basedir}"
5. configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
解决方法:
1). /etc/ld.so.conf.d/local.conf 新增配置:
/usr/local/lib64
/usr/local/lib
2).在编译php的时候加上如下参数:
--with-libdir=lib64
5.安装php的时候还遇到了如下错误:
configure: error: Sorry, I was not able to diagnose which libmcrypt version
解决方法:
重新编译libmcrypt,但编译时不要指定路径,而是直接./configure