PHP安装

PHP安装

#Centos7 安装源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

#卸载旧版本
[root@nginx ~]# yum remove php-mysql-5.4 php php-fpm php-common
 
#配置第三方源
[root@nginx ~]# vim /etc/yum.repos.d/php.repo
[php-webtatic]
name = PHP Repository
baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/
gpgcheck = 0

#执行以下命令安装,72w是版本号
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache php72w-pecl-memcached php72w-pecl-redis php72w-pecl-mongodb

#检验
[root@web02 ~]# php -v
PHP 7.2.34 (cli) (built: Oct  1 2020 13:37:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies

配置php

#修改用户
[root@web01 ~]# vim /etc/php-fpm.d/www.conf
user = www
group = www

#如需使用session,注释末尾两行
;php_value[session.save_handler] = files
;php_value[session.save_path]    = /var/lib/php/session

#修改文件上传大小
[root@web01 ~]# vim /etc/php.ini
post_max_size = 100M
upload_max_filesize = 100M

#配置PHP服务将session存储到redis
[root@web01 ~]# vim /etc/php.ini
#原配置 session.save_handler = files
session.save_handler = redis
session.save_path = "tcp://172.16.1.51:6379"


[root@web01 ~]# systemctl restart php-fpm
posted @ 2021-09-24 10:09  泽野  阅读(36)  评论(0编辑  收藏  举报