workerman
#!/bin/bash
# Install PHP 7 For Workerman
# 配置系统环境
yum install -y gcc make autoconf automake wget screen iptables sendmail zip unzip openssl openssl-devel curl curl-devel libxml2 libxml2-devel
# 检查文件
if [ ! -s 'php-7.0.12.tar.gz' ]; then
wget http://cn2.php.net/distributions/php-7.0.12.tar.gz
fi
# 开始安装PHP
tar zxvf php-7.0.12.tar.gz
cd php-7.0.12
./configure --prefix=/usr/local/php7 --enable-pcntl --enable-mysqlnd
make && make install
# 添加PHP常用命令
ln -s /usr/local/php7/bin/php /usr/bin/php
ln -s /usr/local/php7/bin/phpize /usr/bin/phpize
ln -s /usr/local/php7/bin/pecl /usr/bin/pecl
# 配置文件
cp php.ini-production /usr/local/php7/lib/php.ini
# 修改PHP配置文件
sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php7/lib/php.ini
sed -i 's/expose_php = On/expose_php = Off/g' /usr/local/php7/lib/php.ini
echo '[Opcache]
zend_extension = opcache.so
opcache.enable = 1
opcache.enable_cli = 1' >> /usr/local/php7/lib/php.ini
# 创建PHP配置文件快捷方式
ln -s /usr/local/php7/lib/php.ini /etc/php.ini