Suhosin
- shinko2009-12-11论坛元老326
来源:http://imcat.in/suhosin-protect-your-php/
Suhosin 我是在无意中发现的, 上次在 (http://imcat.in/debian-install-nginx-php-spawn-fcgi-mysql/) 用自动安装PHP,安装完后发现被安装了 Hardened-PHP Project .Google下,原来这个东西叫 Suhosin ,朝鲜语,译音为 "保护神" .
Suhosin的作用大概是:"
我英语不好,如果你英语好的去官网看看:(http://www.hardened-php.net/suhosin.127.html) .不废话了,说说安装方法吧
首先去下载PHP版本对应的Suhosin补丁:http://www.hardened-php.net/suhosin/download.html
我的是PHP 5.2.11 所以我下载的是 suhosin-patch-5.2.11
解压suhosin-patch-5.2.11:- gzip -d ./suhosin-patch-5.2.11-0.9.7.patch.gz复制代码进入php源代码目录打上补丁:- gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11 -p1
- cd php-5.2.11
- patch -p 1 -i ../suhosin-patch-5.2.11-0.9.7.patch复制代码因为我要安装phpfpm,所以将补丁一起打上..
接着重建php的configure脚本- ./buildconf --force复制代码然后编译安装- ./configure --prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml --disable-rpath--enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop--enable-sysvsem --enable-inline-optimization --with-curl--with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm--enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd--enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets--with-xmlrpc --enable-zip --enable-ftp --enable-suhosin
- make ZEND_EXTRA_LIBS='-liconv'
- make install复制代码等php编译完成以后,重新php进程或者重启服务器,如果你看到下面这个图,那么恭喜你,守护神已经正常工作了:
[1958](suhosin.jpg)
对于已经编译了的PHP程序,只需要重新编译一次就OK:- ./configure --enable-suhosin --with-what-you-want- make ZEND_EXTRA_LIBS='-liconv'
- make install复制代码对了,转载的请注明个链接,我发现我一篇安装apc为php加速被人转载了N次,没加链接的,虽然我不介意.
[ 本帖最后由 shinko 于 2009-12-11 17:22 编辑 ]