Phpinfo

From GD Walkthroughs and Advice
Jump to: navigation, search

What is the "phpinfo"

The phpinfo() function outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.

Because every system is setup differently, phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system.

When do I need to use it?

Most people use it when trouble shooting errors relating to thier cms.

EX: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

The command can be extremely useful to determine if your php.ini changes have actually occurred.

Creating and using a phpinfo file

1. Inside the file manager navigate to the root of your site.

2. Press the "+file" button.

3. Name the file something easy to remember and nondescript like "memcheck.php".

4. Click on the file and edit it.

5. Put this inside of the file:

<?php
phpinfo();
?>

6. In your browser go to "yourdomain.com/nameofthephpfile.php" replacing the with your domain and the name of the file.

7. Once you have the information you need make sure to remove the file from your hosting.