phpinfo()<\/em><\/strong> is a PHP function that outputs information about PHP’s configuration when invoked.<\/p>\n\n\n\nThe function outputs a large amount of information about the current state of PHP on the system. 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.<\/p>\n\n\n\n
The function takes zero or 1 parameter. This parameter happens to be a flag that you can use to specify what you want to print out. It returns true on success, false on failure.<\/p>\n\n\n\n
Syntax:<\/p>\n\n\n\n
phpinfo ( int $flags = INFO_ALL ) : bool<\/code><\/pre>\n\n\n\nParameter list:<\/p>\n\n\n\n
INFO_ALL<\/strong>: (-1) -> Shows all of the above. This is the default Flag<\/li>INFO_GENERAL<\/strong>: (1) -> The configuration line, php.ini location, build date, Web Server, System, and more.<\/li>INFO_CREDITS<\/strong>: (2) -> PHP Credits.<\/li>INFO_CONFIGURATION<\/strong>: (4) -> Current Local and Master values for PHP directives.<\/li>INFO_MODULES<\/strong>: (8) -> Loaded modules and their respective settings.<\/li>INFO_ENVIRONMENT<\/strong>: (16) -> Environment Variable information.<\/li>INFO_VARIABLES<\/strong>: (32) -> Shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server).<\/li>INFO_LICENSE<\/strong>: (64) -> PHP License information.<\/li><\/ul>\n\n\n\nLet’s Create the phpinfo File Now<\/h2>\n\n\n\n Using your favorite text editor create a blank PHP and name it phpinfo.php<\/strong>. Take note that the file can be named anything you want, just make sure it is a good descriptive name.<\/p>\n\n\n\nAdd the following line into the phpinfo.php<\/strong> file.<\/p>\n\n\n\nIf you want to change the default results printed out you can use one of the seven other parameters (other than the default parameter). For example:<\/p>\n\n\n\n
Upload the phpinfo.php<\/strong> file to your server’s document root folder using an FTP client such as FileZilla or your web host’s File Manager if you are using a hosting control panel such as CPanel. If you are on a localhost development environment then simply save it to the document root folder.<\/p>\n\n\n\nCheck PHP Information Using a Browser<\/h2>\n\n\n\n Now that the file has been uploaded onto the web server’s document root we can invoke it by running http:\/\/yourdomain.com\/\/phpinfo.php<\/strong><\/em>.<\/p>\n\n\n\nYou should see output similar to this:<\/p>\n\n\n\nOutput from phpinfo() function call<\/figcaption><\/figure>\n\n\n\nNote: phpinfo() outputs plain text instead of HTML when using the CLI mode.<\/em><\/p>\n\n\n\nConclusion<\/h2>\n\n\n\n That’s it! You now have access to the PHP configuration for your environment whenever you need it.<\/p>\n\n\n\n
As you create a phpinfo file you must be cautious about security. Do not leave this file as is when you do not need it. You can temporarily disable it by renaming it to something like phpinfo.php_disabled<\/strong> and renaming it back to the original as needed.<\/p>\n\n\n\nRef [1<\/a>]<\/p>\n","protected":false},"excerpt":{"rendered":"This guide will show you how to create a phpinfo file and use it to check the PHP configuration information on your web server. phpinfo() is a PHP function that…<\/p>\n","protected":false},"author":1,"featured_media":9398,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16,18],"tags":[58,193,308,354,400,452,526,531,573,635,636,638],"yoast_head":"\n
How to Create phpinfo File and Check PHP Configuration<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n