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
执行安装
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
执行php-fpm启动php-fpm
4.安装mysql数据库
下载 MySQL Yum Repository
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
添加 MySQL Yum Repository
添加 MySQL Yum Repository 到你的系统 repository 列表中,执行
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'
网友评论