Categories
linux PHP

How to Enable and disable phpinfo()

The phpinfo() function is mostly disabled in the shared hosting service due to security reasons. phpinfo()is disabled, 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.

phpinfo()
phpinfo()

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

You want to enable phpinfo

Considering you have access to the server’s php.ini file then edit this file in any editor e.g. vim. Search and 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 in your own version of php.ini. If that doesn’t work, learn “How to debug php application with phpinfo() disabled ?

You want to disable phpinfo

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');
'Coz sharing is caring

By Swatantra Kumar

Swatantra is an engineering leader with a successful record in building, nurturing, managing, and leading a multi-disciplinary, diverse, and distributed team of engineers and managers developing and delivering solutions. Professionally, he oversees solution design-development-delivery, cloud transition, IT strategies, technical and organizational leadership, TOM, IT governance, digital transformation, Innovation, stakeholder management, management consulting, and technology vision & strategy. When he's not working, he enjoys reading about and working with new technologies, and trying to get his friends to make the move to new web trends. He has written, co-written, and published many articles in international journals, on various domains/topics including Open Source, Networks, Low-Code, Mobile Technologies, and Business Intelligence. He made a proposal for an information management system at the University level during his graduation days.

One reply on “How to Enable and disable phpinfo()”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.