Home >Backend Development >PHP Problem >How to disable eval in php under win
How to disable eval in PHP under win: 1. Download "PHP_diseval_extension"; 2. Find the PHP currently used by the server; 3. Open the PHP configuration file; 4. Add the "extension=diseval.so" code; 5 , just restart the service.
The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.
How to disable eval in php under win?
php disable eval function explanation
1. What is eval
eval is a language constructor, not a system component function. Therefore, we cannot disable it by using disable_functions in php.ini.
2. Dangers of eval
eval() is very lethal to PHP security. Therefore, in order to prevent the intrusion of Trojan horses like the following when it is not generally used, it needs to be banned. !
3. How to disable
3-1. Download PHP_diseval_extension
github address: https://github.com/mk-j/PHP_diseval_extension
Installation method:
3-2. Find the PHP currently used by the server
whereis php
The server PHP version is 7.1
Find the execution of phpize Directory
3-3. Enter any folder in the root directory. I tried the tmp directory but failed to compile, prompting a permission issue. Try other directories and it will be fine.
cd / git clone https://github.com/mk-j/PHP_diseval_extension.git cd /home/PHP_diseval_extension/source //使用PHP安装路径的phpize 执行一下命令 /opt/cpanel/ea-php71/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php71/bin/php-config make && make install
Add after normal compilation is successful. Extension, find the currently effective PHP configuration file
Command: php --ini
## 3-4. Add the following code and restart the serviceextension=diseval.soRecommended learning: "
PHP Video Tutorial"
The above is the detailed content of How to disable eval in php under win. For more information, please follow other related articles on the PHP Chinese website!