How to Create a phpinfo Page

A phpinfo page is a simple PHP script that usually only has one line of code:

<? php phpinfo(); ?>

You can create a phpinfo.php file and place it anywhere on any website on your server to view the current PHP configuration. That single line of code will return a plethora of detailed information about your PHP installation, including:

  • the current version
  • the operating system, version, hostname, and system timezone
  • the actual configure command and flags used during compilation
  • server API
  • path to php.ini
  • path to any local php.ini file
  • configuration options, such as log_errors, memory_limit, post_max_size, safe_mode, register_globals, and many others.

Your phpinfo will also list active modules loaded with PHP and their current configuration settings. Finally, the bottom of the page lists environment variables for your server and relevant information for your particular session and user agent.

A phpinfo page is very helpful for ensuring that you have configured your PHP installation exactly the way you want it, and it is also an excellent tool for troubleshooting problems with scripts and web applications. Some CMS software have specific PHP configuration requirements, and you can use phpinfo to determine if they are in effect or that your site is loading the correct configuration file.

You can name your phpinfo file anything you want and store it anywhere on your server. If you are concerned about security and do not want others to view it, you can password protect the directory, remove the file when finished, simply set deny permissions for the file (such as “chmod 600”) when you are not using it.











Comments: