2. PHP5.6 部署
最后更新于:2022-04-02 07:47:03
#### 安装依赖
```shell
yum install zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt libxslt-devel openssl openssl-devel
```
##### 依赖包注释
```shell
zlib-devel #压缩支持
libxml2-devel #管理xml文件
libjpeg-turbo-devel #使用libjpeg实现图像的输入输出和像素读写
freetype-devel #渲染字体
libpng #解析png图片
gd-devel #php处理图形的扩展库
libcurl-devel #用不同协议沟通不同服务器
libmcrypt #提供统一接口的对称加密算法库
mcrypt #加密算法扩展库
mhash #不可逆向的php加密方式扩展库
libxslt-devel #转换XML文件
```
##### libiconv需编译安装 #支持编码转换
```shell
cd /opt/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar xzf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure --prefix=/usr/local/libiconv
make && make install
echo $?
```
#### 安装PHP 5.6
```shell
./configure \
--prefix=/usr/local/php-5.6.30 \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
```
和PHP5.3的编译参数区别
```shell
--enable-safe-mode
--with-curlwrappers
--enable-zip
--enable-zend-multibyte
```
建立软连接
```shell
ln -s /usr/local/php-5.6.30 /usr/local/php
```
#### 配置PHP
复制生产配置文件
```shell
cp /opt/php-*/php.ini-production /usr/local/php/lib/php.ini
cd /usr/local/php/etc && cp php-fpm.conf.default php-fpm.conf
mkdir /app/logs
```
需要编辑部分
```shell
cat > /usr/local/php/etc/php-fpm.conf <
';