安裝依賴
yum install libxml2-devel curl-devel openjpeg openjpeg-devel openjpeg-libs libjpeg libpng freetype libjpeg libpng-devel freetype-devel mcrypt
php-mcrypt libmcrypt libmcrypt-devel
下載:wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
添加用戶組
groupadd -r php && useradd -r -g php -s /bin/flase -M /usr/local/php7
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include
--libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-zlib --enable-zip --enable-mysqlnd --with-mysqli=shared,mysqlnd
--with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp
--enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=apache --with-fpm-group=apache
--without-gdbm --disable-fileinfo --with-bz2 --enable-maintainer-zts
# cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
# /etc/init.d/php-fpm
CentOS源不能安裝libmcrypt-devel,由於版權的原因沒有自帶mcrypt的包。
有兩種方法解決,一種是使用第三方源,這樣還可以使用yum來安裝,簡單方便,壞處是第三方源多少有中不可靠的感覺。
解決辦法一
1、安裝第三方yum源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
2、使用yum命令安裝
yum install php-mcrypt libmcrypt libmcrypt-devel
解決辦法二、
使用php mcrypt 前必須先安裝Libmcrypt
libmcrypt源碼安裝方法:
cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure --prefix=/usr/local
make
make install
本篇文章來源於 Linux公社網站(www.linuxidc.com) 原文鏈接:http://www.linuxidc.com/Linux/2015-08/121079.htm