Home > Article > Backend Development > What should I do if phpinfo() cannot come out of php code security?
php code security The solution to the problem that phpinfo() cannot come out: first open the php.ini file, find the "short_open_tag" item, and set it to "short_open_tag = On"; then restart apache and reload the php.ini service That’s it.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
1. Problem description
I wrote a php file test.php, the code is as follows:
<?php echo phpinfo(); ?>
The browser visited it, but returned NULL.
##2. Problem location and solution
I checked online and found that the problem encountered by most people is actually the problem of short_open_tags , their code is as follows:<? echo phpinfo(); ?>
Solution:
In this case, you need to open the php.ini file, find "short_open_tag", and comment the line short_open_tag = Off Off, then open it; short_open_tag = On is enough, then restart apache, reload the php.ini service and it will be OK.disable_functions stringThis command allows you to prohibit certain functions for security reasons. . Accepts a comma separated list of function names as arguments. disable_functions are not affected by safe mode. This directive can only be set in php.ini. For example, it cannot be set in httpd.conf
disable_functions = phpinfo,system,proc_open,proc_close,show_source,popen,pcloseIt suddenly dawned on me, temporarily deleted the phpinfo() method from disable_functions, reloaded the php.ini file, and then accessed test.php from the browser again, this time it was successful. Yes, problem solved. However, I would like to remind my friends that phpinfo() is very sensitive information. It is usually best not to expose it to the client, so I quickly turned it off after the test.
PHP Video Tutorial"
The above is the detailed content of What should I do if phpinfo() cannot come out of php code security?. For more information, please follow other related articles on the PHP Chinese website!