centos 安装 php7

8 篇文章 0 订阅

安装版本:php7.1.7
1、下载镜像
http://am1.php.net/distributions/php-7.1.7.tar.bz2
2、安装依赖

yum install -y gcc gcc-c++ make cmake bison autoconf wget lrzsz
yum install -y libtool libtool-ltdl-devel 
yum install -y freetype-devel libjpeg.x86_64 libjpeg-devel libpng-devel gd-devel
yum install -y python-devel  patch  sudo 
yum install -y openssl* openssl openssl-devel ncurses-devel
yum install -y bzip* bzip2 unzip zlib-devel
yum install -y libevent*
yum install -y libxml* libxml2-devel
yum install -y libcurl* curl-devel 
yum install -y readline-devel

3、编译安装

./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc/ --with-mcrypt=/usr/include --enable-mysqlnd --with-gd --with-iconv=/usr/local/libiconv --with-zlib --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --with-curl --with-jpeg-dir --with-freetype-dir --with-mysqli --enable-embedded-mysqli  --with-pdo-mysql
make clean && make && make install

4、配置文件

cp php.ini-production /usr/local/php7/etc/php.ini

cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm

chmod +x /etc/init.d/php7-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
vim /usr/local/php7/etc/php.ini
# 加入
zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so

5、启动php-fpm

/etc/init.d/php7-fpm start

# 查看PHP版本
/usr/local/php7/bin/php -v
为了安全最好是去掉头信息  X-Powered-By: PHP/7.*.*
则修改 php.ini 文件 设置 expose_php = Off
vim /usr/local/php7/etc/php.ini
找到 expose_php = On
改为 expose_php = Off

6、修改用户及用户组


user = www
group = www
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值