Here we show you a few ways on how to view the phpinfo() outputOutput in computer science or information technology is the response received from a computing device based on a given input. The target of the response could be the same device or another connected device. Some examples of output devices include monitors, printers, other networked computers, speakers, and storage devices among others.... More from the command-line in Linux as an alternative to Apache or Nginx web serversA server is a computer application program that responds to requests for information from a client in a client/server relationship system. A typical example is a web server or pushing a web page to a web browser or a web server receiving email and transferring it to an email client. A server can also refer to the actual hardware designed... More.
Usually, to invoke the phpinfo(), users go through the process of creating a PHP file such as info.php somewhere on your web serverA server is a computer application program that responds to requests for information from a client in a client/server relationship system. A typical example is a web server or pushing a web page to a web browser or a web server receiving email and transferring it to an email client. A server can also refer to the actual hardware designed... More such as the document root then insert the following code into the file:
The file can be executed on a web serverA server is a computer application program that responds to requests for information from a client in a client/server relationship system. A typical example is a web server or pushing a web page to a web browser or a web server receiving email and transferring it to an email client. A server can also refer to the actual hardware designed... More from the web browser to print out details about the PHP set up by going to http://localhost/info.php.
phpinfo() is a PHP function that outputs information about PHP’s configuration. Read more about it in this post.
View phpinfo() Output From Command-line
From your command line you can run the following command to get the configuration from the default php.ini file:
$ php -i
You can also use it in interactive mode:
$ php -a
Interactive shell
php > phpinfo();
You can also run it the command-line:
$ php -r "phpinfo();"
Or even run the function phpinfo() on the shell directly:
$ php -r phpinfo();
The problem with the above commands is that you get to echo the phpinfo() outputOutput in computer science or information technology is the response received from a computing device based on a given input. The target of the response could be the same device or another connected device. Some examples of output devices include monitors, printers, other networked computers, speakers, and storage devices among others.... More from the default php.ini file. In the real world, you will find PHP setups with more than one configuration. The most common is where you have two configurations, one for the CLI and the second for Apache. If you use PHP-fpm you will have yet another configuration file.
The situation can get more complicated depending on your Linux distro. For example, Ubuntu and other major distros would further split the three configuration files into the PHP version.
To get around this you have to tell PHP which configuration you want to print out using the following example:
$ php -c /etc/php/7.4/fpm/php.ini -i
The above example prints out the phpinfo() outputOutput in computer science or information technology is the response received from a computing device based on a given input. The target of the response could be the same device or another connected device. Some examples of output devices include monitors, printers, other networked computers, speakers, and storage devices among others.... More from the php.ini file that is used by PHP-fpm and PHP version 7.4.