How to view PHP settings using the phpinfo() function
This article describes how to use the phpinfo() function to view detailed information about the PHP environment, settings, and more.
To view phpinfo() output on our servers, you must have an A2 Hosting account. The information revealed by the phpinfo() function poses a potential security risk, so we do not post it publicly. Hackers and other malicious actors could use the information from phpinfo() to plan an attack.
View PHP settings
You often need to check PHP settings during web development. You can do this by running a script that calls the phpinfo() function. When you load the page in a web browser, the script shows all of the PHP configuration settings for your web site.
To use the phpinfo() function to view PHP settings:
- Create a file that contains the following code:
- Save the file as info.php or something similar.
- Upload the file to your public_html directory.
Use your browser to go to http://example.com/info.php, where example.com represents your web site's domain name. The page displays a large amount of information about the PHP installation.
For security reasons, you should disable any calls to the phpinfo() function when web site development and testing is complete.
For more information about the phpinfo() function, please visit http://www.php.net/manual/en/function.phpinfo.php.
- PHP script basics
Can I use short tags in my PHP scripts? What are the correct file permissions for my PHP scripts? If you’re new to A2 Hosting or PHP development in general, get answers to these essential questions and more here.
- Custom php.ini files
You can use php.ini files to customize a wide range of PHP settings for your web site. Learn how here.