首页 > 代码库 > CentOS7快速安装PHP7.0指南

CentOS7快速安装PHP7.0指南

一、删除旧版本
rpm -qa|grep php*
or 
yum list installed |grep php
yum remove php*
二、安装新版本
1.更新yum安装包
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.安装php和其它组件
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

yum install php70w-fpm

sed -i -r "/^max_execution_time/ s@(max_execution_time = )[0-9]+@\1300@" /etc/php.ini
sed -i -r "/^memory_limit/ s@(memory_limit = )[0-9]+(M)@\1128\2@" /etc/php.ini
sed -i -r "/^post_max_size/ s@(post_max_size = )[0-9]+(M)@\116\2@" /etc/php.ini
sed -i -r "/^upload_max_filesize/ s@(upload_max_filesize = )[0-9]+(M)@\12\2@" /etc/php.ini
sed -i -r "/^max_input_time/ s@(max_input_time = )[0-9]+@\1300@" /etc/php.ini
sed -i -r "/^always_populate_raw_post_data/d; /^;always_populate_raw_post_data/ a\always_populate_raw_post_data = http://www.mamicode.com/-1" /etc/php.ini
sed -i -r "/^expose_php/ s@(expose_php = )On@\1Off@" /etc/php.ini

vim /etc/php.ini
date.timezone = Asia/Shanghai
systemctl enable php-fpm
systemctl start php-fpm 

 

CentOS7快速安装PHP7.0指南