How to Enable and disable phpinfo()

  • Sumo

The phpinfo() function is mostly disabled in the shared hosting service due to security reasons as it displays information which can be used to compromise the server. By disabling the phpinfo() one can take a step to secure the server, but it becomes difficult for debugging.

Here are steps for enabling and disabling the phpinfo() :-

If phpinfo() is disabled and you want to enable it

Considering you have access to the server’s php.ini file then change the disable_functions directive from disable_functions = phpinfo to disable_functions =

Considering you don’t have access to your server’s php.ini file (most likely case), you may be able to create your own php.ini file and change the disable_functions directive that way. If that doesn’t work, learn “How to debug php application with phpinfo() disabled ?

If phpinfo() is enabled and you want to disable it

Considering you have access to the server’s php.ini file, then change the line that includes the disable_functions directive so that it says disable_functions = phpinfo

Considering you don’t have access to your server’s php.ini file, you may be able to create your own php.ini file and change the disable_functions directive that way. Or, add a line in the application that says

ini_set('disable_functions', 'phpinfo');

One Comment

  1. […] Though you can get lot of information without need of enabling phpinfo() but still if you want to enable it, learn “How to Enable and disable phpinfo()“. […]

Leave a Reply

Your email address will not be published. Required fields are marked *