1.安裝必要的庫
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
2.下載php源碼
curl -O http://cn2.php.net/distributions/php-7.0.21.tar.gz
tar -zxvf php-7.0.21.tar.gz
3.安裝
./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/lib/mysql/mysql.sock --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-openssl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --enable-fileinfo
執(zhí)行安裝
make clean && make && make install
開始設置PHP7的配置文件php.ini、php-fpm.conf臂痕、www.conf和php-fpm腳本
cp php.ini-production /usr/local/php7/etc/php.ini
cp /root/php-7.0.0/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
執(zhí)行php-fpm啟動php-fpm
4.安裝mysql數(shù)據(jù)庫
下載 MySQL Yum Repository
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
添加 MySQL Yum Repository
添加 MySQL Yum Repository 到你的系統(tǒng) repository 列表中宛琅,執(zhí)行
yum local install mysql-community-release-el7-5.noarch.rpm
yum install ?mysql-community-server
啟動mysql
systemctl start mysqld
設置mysql密碼
/usr/bin/mysqladmin -u root password 'passwd'