wget -O php-7.1.4.tar.gz http://cn2.php.net/distributions/php-7.1.4.tar.gz
tar zxvf php-7.1.4.tar.gz
cd php-7.1.4
./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-apxs2 --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/tmp/mysql.socket --with-mcrypt=/usr/include --with-mhash --with-openssl --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 --without-gdbm --disable-fileinfo
缺东西的自行 yum install
安装即可,通过后执行编译:
make clean && make && make install
看见这个就成功了。
/root/php-7.1.4/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers: /usr/local/php7/include/php/ext/pdo/
make test
设置 PHP7 的配置文件 php.ini
、php-fpm.conf
、www.conf
和 php-fpm 脚本
cp php.ini-production /usr/local/php7/etc/php.ini
cp /root/php-7.1.4/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
将 PHP 编译生成的 bin 目录添加到当前 Linux 系统的环境变量中:
echo -e '\nexport PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH\n' >> /etc/profile && source /etc/profile
chmod +x /etc/init.d/php-fpm
chkconfig php-fpm on
php -v