安装第三方YUM源
bash
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
bash
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
bash
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
bash
sudo systemctl start php-fpm && \
sudo systemctl enable php-fpm
bash
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 && \参考文档: