cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
Install PHP7
1 添加源
yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2 安装php7
添加源后,更新一下,yum updateinfo
,然后yum search php7
看下源里PHP7存在哪些小版本:
...mod_php71w.x86_64 : PHP module for the Apache HTTP Serverphp71w-bcmath.x86_64 : A module for PHP applications for using the bcmathphp71w-cli.x86_64 : Command-line interface for PHPphp71w-common.x86_64 : Common files for PHPphp71w-dba.x86_64 : A database abstraction layer module for PHP applicationsphp71w-devel.x86_64 : Files needed for building PHP extensionsphp71w-embedded.x86_64 : PHP library for embedding in applicationsphp71w-enchant.x86_64 : Enchant spelling extension for PHP applications...
看样子已经到PHP7.1了,那就体验下最新的特性,使用命令yum install mod_php71w php71w-cli php71w-devel php71w-mysql
安装,如果没有MySQL需求,可以去掉php71w-mydql. 安装成功后,php -v
查看版本信息:
PHP 7.1.5 (cli) (built: May 12 2017 21:54:58) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Install Nginx
安装nginx也比较简单,根据就可以完成。 我安装的是稳定版。 vi /etc/yum.repos.d/nginx.repo
[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/7/$basearch/gpgcheck=0enabled=1
然后yum search nginx
查看版本,选择需要的版本,我选了默认的版本,并安装了扩展:yum install nginx nginx-all-modules
. 安装完毕,nginx -V
查看Nginx的版本和路径参数及扩展支持:
nginx version: nginx/1.12.0built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013TLS SNI support enabledconfigure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'