The eval function of PHP is not a system component function, so we cannot prohibit it by using disable_functions in php.ini.
But Eval () is very lethal to PHP security, so generally do not use the case in order to prevent similar to the following a word Trojan intrusion, need to prohibit!
<?php eval ($_post[cmd]);? >
Eval () Usage Example:
<?php
$string = ' Cup ';
$name = ' coffee ';
$str = ' This $string is fitted with $name .<br> ';
echo $str;
Eval ("$str =" $str ";");
echo $str;
? >
The return value for this example is:
$name is fitted in this $string.
This cup contains coffee.
Or more advanced points are:
<?php
$str = "Hello World";//This is the result of the meta calculation
$code = "Print (' n$strn ');"; /This is stored in the database PHP code
echo ($code);//print the combination of the command, the STR string is replaced to form a complete PHP command, but does not execute
eval ($code);/execute this command
?>
For the above example of the coffee, in eval, the string is replaced first, and then a complete assignment command is executed after the substitution is completed.
This kind of pony smash door situation is need to forbid to drop!
However, many people on the internet say that the use of disable_functions to prohibit the Eval method is wrong!
In fact, eval () cannot be banned by the disable_functions in php.ini:
because Eval () is a language construct and not a function
Eval is Zend, so it is not a php_function function;
So how does PHP prohibit eval?
If you want to ban eval, you can use PHP's extended suhosin:
Install Suhosin in php.ini load in suhosin.so, plus suhosin.executor.disable_eval = on can!
To summarize,PHP's eval function is not disabled in PHP, so we only use Plug-ins!