Welcome to PHPBash | Helping You to Become an Expert in PHP Programming. In this PHP Tutorial for beginners and professionals, I will cover How to create a phpinfo.php page & check PHP Configuration, What is phpinfo()?, How to use phpinfo() and its example. You can use a phpinfo() page to view the current Configurations and Settings of PHP information with configured web server.
How to create a phpinfo.php page & check PHP Configuration?
This PHP tutorial covers all the topics of How to create a phpinfo.php page & check PHP Configuration such as
1. What is PHP phpinfo()?
2. What information phpinfo() displays?
3. How to use phpinfo()?
4. Example of phpinfo()
Let's start PHP tutorial with questions, What is PHP phpinfo()?
What is PHP phpinfo()?
You can use a phpinfo() page to view the current information of Configurations and Settings of PHP with configured web server. phpinfo() function has an optional argument. If this function is called with no argument, then will display all information. phpinfo() function is used to check whether required support is present with the web server or not.
What information phpinfo() displays?
The PHP phpinfo() outputs a various configuration details and their values with your server. It Outputs a large amount of information about the current state of PHP. The phpinfo() is also a valuable debugging tool as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
The PHP phpinfo() prints or displays details such as-
1. PHP includes,
2. Platform information,
3. Information about PHP compilation options and extensions,
4. Server information and environment (if compiled as a module),
5. PHP and server environment,
6. OS version information,
7. Master and local values of configuration options,
8. Various paths,
9. HTTP headers,
10. PHP core details like version and directives status,
11. PHP License information and Version etc.
How to use phpinfo()?
The phpinfo() function can be used as phpinfo(); as a PHP Statement.With this, It will display all information. For Example, phpinfo() can be used as follows:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
The output of phpinfo() may be customized as per requirement by passing one or more constants bitwise values as argument. The various constants bitwise values are:
1. INFO_GENERAL- The configuration line, php.ini location, build date, Web Server,
2. INFO_CREDITS- PHP Credits.
3. INFO_CONFIGURATION- Current Local and Master values for PHP directives.
4. INFO_MODULES- Loaded modules and their respective settings.
5. INFO_ENVIRONMENT- Environment Variable information that's also available in $_ENV.
6. INFO_VARIABLES- variables from EGPCS (Environment, GET, POST, Cookie, Server).
7. INFO_LICENSE- PHP License information.
8. INFO_ALL- Shows all of the above.
While passing this values, phpinfo() Returns TRUE on success or FALSE on failure.
Now let see following example where we are displaying only INFO_MODULES
<?php
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
Example of phpinfo()
The following example will display all information and then information about license of PHP.
<?php
// Show all information, defaults to INFO_LICENSE
phpinfo();
// Show just the module information.
// phpinfo(7) yields identical results.
phpinfo(INFO_LICENSE);
?>
 |
phpinfo() Example Code in Sublime Text |
If you execute above code, it will display output like
 |
phpinfo() Displays all PHP Settings |
 |
phpinfo() Displays PHP Licence Information Only |
I hope this PHP tutorial might have given a much better idea about "creating a phpinfo.php page & knowing your PHP Configuration". If you have any doubt/query related to PHP or Web Technologies, Please let me know in Comment Section. Please share it with your friends.
Sharing is caring ❤️
Thank you for Visiting PHPBash. Keep Visiting for more Interesting concepts of Php language and web technologies from basics to advanced. As well we will also share some ready-to-use, useful code snippets for beginners to kick start their web development project.
Do you want to build a modern, lightweight, responsive website and launch quickly?
I help to create the best websites / web applications and will be available for freelance work. contact: phpgems28@gmail.com
Comments
Post a Comment
Thank you so much.