在php.ini中这样设置disable_functions =eval是无法禁用eval的,根据php手册说明,eval是一个语言构造器而不是一个函数。 如果要禁用eval,则需要第三方扩展,使用Suhosin。 Suhosin是朝鲜语“守护神”的音译,是一个专门的安全小组开发的专门针对php进行安
在php.ini中这样设置disable_functions =eval是无法禁用eval的,根据php手册说明,eval是一个语言构造器而不是一个函数。
如果要禁用eval,则需要第三方扩展,使用Suhosin。
Suhosin是朝鲜语“守护神”的音译,是一个专门的安全小组开发的专门针对php进行安全加固的补丁程 序,已经进入freebsd gentoo的ports系统。效果很好的。
Suhosin是php增强型安全补丁,可以编译到静态内核中,也可以编译成php动态扩展。我个人强烈你建议静态联编。下面的以下先说静态安装步骤。当然你也可以在安装php后将它编译成php的动态扩展。
# cd /usr/local/src # wget http://cn.php.net/get/php-5.2.5.tar.gz/from/this/mirror wget http://www.hardened-php.net/suhosin/_media/suhosin-patch-5.2.5-0.9.6.2.patch.gz //从官方下载补丁 # tar zxvf php-5.2.5.tar.gz # gunzip suhosin-patch-5.2.5-0.9.6.2.patch.gz // 解压补丁 # cd php-5.2.5 # patch -p 1 -i ../suhosin-patch-5.2.5-0.9.6.2.patch // 给php打上补丁 # ./buildconf --force //一定要执行这一步。 # CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static --enable-maintainer-zts --enable-memory-limit --enable-zend-multibyte --enable-sockets --enable-soap --enable-suhosin // 配置选项 # make # make install 重启apachectl,查看phpinfo信息,会出现 This server is protected with the Suhosin Patch 0.9.6.2 Copyright (c) 2006 Hardened-PHP Project 等许多Suhosin信息那么你就成功了。呵呵。 在这里也顺便说一下将suhosin安装成为php的动态扩展的方法。 wget http://download.suhosin.org/suhosin-0.9.23.tgz tar zxvfsuhosin-0.9.23.tgz cd suhosin-0.9.23 /usr/local/php/bin/phpize //这一步不能省 ./configure --with-php-config=/usr/local/php/bin/php-config //必须在这儿注明php-config所在的绝对路径。 make make install 会提示编译的模块存在的目录,记住它。 Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ 然后在php.ini中增加一行下列语句。 extension=suhosin.so suhosin.executor.disable_eval = on
如果对于部分业务需要运行eval咋办?如果是 PHP 5.3+ 且 CGI/FastCGI 方式运行,可以这么改 php.ini,则可以破例使用? eval
操作方法:
suhosin.executor.disable_eval = on [PATH=/htdocs/www/ex1/] suhosin.executor.disable_eval = off
最后重启php-fpm 即可!



Alat AI Hot

Undresser.AI Undress
Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover
Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool
Gambar buka pakaian secara percuma

Clothoff.io
Penyingkiran pakaian AI

Video Face Swap
Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Artikel Panas

Alat panas

Dreamweaver Mac版
Alat pembangunan web visual

mPDF
mPDF ialah perpustakaan PHP yang boleh menjana fail PDF daripada HTML yang dikodkan UTF-8. Pengarang asal, Ian Back, menulis mPDF untuk mengeluarkan fail PDF "dengan cepat" dari tapak webnya dan mengendalikan bahasa yang berbeza. Ia lebih perlahan dan menghasilkan fail yang lebih besar apabila menggunakan fon Unicode daripada skrip asal seperti HTML2FPDF, tetapi menyokong gaya CSS dsb. dan mempunyai banyak peningkatan. Menyokong hampir semua bahasa, termasuk RTL (Arab dan Ibrani) dan CJK (Cina, Jepun dan Korea). Menyokong elemen peringkat blok bersarang (seperti P, DIV),

SublimeText3 Linux versi baharu
SublimeText3 Linux versi terkini

Muat turun versi mac editor Atom
Editor sumber terbuka yang paling popular

PhpStorm versi Mac
Alat pembangunan bersepadu PHP profesional terkini (2018.2.1).
