CentOS 7.2 64位安装LNMP php7+Mysql 5.7

刚买好的阿里云,更新下系统

yum update

1.安装nginx源
 yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.安装nginx
 yum install nginx

3.启动nginx
service nginx start
4.访问http://你的ip/ 能看到Nginx的欢迎页就安装成功了

安装MySQL5.7.*
1.安装mysql源
yum localinstall  http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

2.安装mysql
 yum install mysql-community-server

确认一下mysql的版本,有时可能会提示mysql5.6

3.安装mysql的开发包,以后会有用
yum install mysql-community-devel

4.启动mysql
service mysqld start

5.查看mysql启动状态
service mysqld status

出现pid

证明启动成功
 
  

编译安装php7.0.0
1.下载php7源码包
cd /root & wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.0.tar.gz/from/this/mirror

2.解压源码包
tar -xvf php7.tar.gz
3.
cd php-7.1.0

4.安装php依赖包

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel gcc vim

5.编译配置,这一步我们会遇到很多configure error,我们一一解决,基本都是相关软件开发包没有安装导致

./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--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 \
--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

6.编译与安装

make && make install

这里要make好久,要耐心一下

7.添加 PHP 命令到环境变量
vim /etc/profile
在末尾加入

PATH=$PATH:/usr/local/php/bin
export PATH

要使改动立即生效执行

./etc/profile

或 
source /etc/profile

查看环境变量
echo $PATH

查看php版本
php -v



你可能感兴趣的:(Linux/Windows,系统操作)