🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### 安装依赖 ```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 <<EOF [global] pid = /app/logs/php-fpm.pid error_log = /app/logs/php-fpm.log log_level = error rlimit_files = 65535 events.mechanism = epoll [www] user = nginx group = nginx listen = 127.0.0.1:9000 pm = dynamic pm.max_children = 1024 pm.start_servers = 16 pm.min_spare_servers = 1 pm.max_spare_servers = 20 slowlog = /app/logs/$pool.log.slow request_slowlog_timeout = 10 EOF ```