今天迁移一个系统需要ZendGuardLoader,就下载了lnmp安装包 ,安装选择的apache+php5.3.29,但是安装完后发现ZendGuardLoader没有加载成功,排查phpinfo()发现这个Thread Safety值是enabled,然后自己又下载了一个php5.3.29重新编译安装。
编译参数:./configure --prefix=/usr/local/php5.3nts --with-config-file-path=/usr/local/php5.3nts/etc --with-config-file-scan-dir=/usr/local/php5.3nts/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fileinfo
如果报 make: *** [sapi/fpm/php-fpm] error 1 这个错 就加上
make ZEND_EXTRA_LIBS='-liconv'
安装好后配置好php-fpm 启动php-fpm #/usr/local/php5.3/sbin/php-fpm
然后配置php,在/usr/local/php5.3/etc下新建php.ini文件或者去源码包里复制一个过来,因为默认是没有这个文件的。#配置ZendGuardLoader
[Zend.loader]
zend_extension="/usr/local/php5.3/lib/php/extensions/no-debug-zts-20090626/ZendGuardLoader_64.so"
zend_loader.enable=1
zend_loader.disable_licensing=1
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_optimizer.optimization_level=0
需要先开启apache的以下模块
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
官方文档 有讲可以自己看 https://wiki.apache.org/httpd/PHP-FPM
配置apache
ServerAdmin xxx@xx.com
php_admin_value open_basedir "/wwwroot/xxx:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/wwwroot/xxx"
ServerName xxx.com
ErrorLog "/home/wwwlogs/xxx.com-error_log"
CustomLog "/home/wwwlogs/xxx.com-access_log" combined
#加下面这句,设置php-fpm,我的端口是9001自己的自己配置
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9001/wwwroot/xxx/$1
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
全部配置完成。