导航
导航
文章目录
  1. 安装第三方YUM源
  2. 安装 php7.1.x
  3. 启动 php

CentOS 从 Yum 源安装配置 PHP7.1

安装第三方YUM源

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

安装 php7.1.x

yum install \
    php71w-bcmath \
    php71w-common \
    php71w-fpm \
    php71w-gd \
    php71w-imap \
    php71w-mbstring \
    php71w-mcrypt \
    php71w-mysql \
    php71w-opcache \
    php71w-pdo \
    php71w-pdo_dblib \
    php71w-pear \
    php71w-pecl-mongodb \
    php71w-xml \
    php71w-xmlrpc

安装 php5.6.x

yum install \
    php56w-bcmath \
    php56w-common \
    php56w-fpm \
    php56w-gd \
    php56w-imap \
    php56w-mbstring \
    php56w-mcrypt \
    php56w-mysql \
    php56w-opcache \
    php56w-pear \
    php56w-pecl-xdebug \
    php56w-pgsql \
    php56w-xml \
    php56w-xmlrpc

启动 php

sudo systemctl start php-fpm && \
sudo systemctl enable php-fpm
    sed -i "s|;*date.timezone =.*|date.timezone = Asia/Shanghai|i" /etc/php.ini && \
    sed -i "s|;*memory_limit =.*|memory_limit = 512M|i" /etc/php.ini && \
    sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = 128M|i" /etc/php.ini && \
    sed -i "s|;*max_file_uploads =.*|max_file_uploads = 25|i" /etc/php.ini && \
    sed -i "s|;*post_max_size =.*|post_max_size = 256M|i" /etc/php.ini && \
    sed -i "s|;\s*max_input_vars =.*|max_input_vars = 5000|i" /etc/php.ini && \
    sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" /etc/php.ini && \

参考文档:

支持一下
扫一扫,支持一下