Is there a way to force phpinfo() to output its stuff without formatting. Just like in CLI mode?

phpinfo command
php ini function
php display settings
php _info
dump php ini
phpinfo w3schools
php info dump
show php --ini

But of course in normal mode not CLI. Formated output included among other HTML destroys existing webpage layout.

There are some good examples of converting the information into an array on the site.

Here is the best example. You could loop through that array to display it in whatever way you'd like.

Your first PHP-enabled page - Manual, Create a file named hello.php and put it in your web server's root directory Note that the file does not need to be executable or special in any way. it did not output anything, it prompted for download, or you see the whole file as text, You may jump in and out of PHP mode in an HTML file like this anywhere you want. EDIT: As mentioned by binaryLV, its quite common to have two versions of a php.ini per installation. One for the command line interface (CLI) and the other for the web server interface. If you want to see phpinfo output for your web server make sure you specify the ini file path, for example php -c /etc/php/apache2/php.ini -i

I just got done creating the composer library for this very purpose. Right now, it can parse the phpinfo() output when invoked from the command line, which was my use case.

Instead of using strip_tags() or any clever trick, I just worked my way backwards from everything that the original function did.

You can use the library like so:


$phpinfoAsString = ob_get_contents();

$phpInfo = new OutCompute\PHPInfo\PHPInfo();

You can access keys within modules and elsewhere:

echo $phpInfoArray['Configuration']['bz2']['BZip2 Support']; # Will output 'Enabled' if enabled


echo $phpInfoArray['Thread Safety'] # Will output 'disabled' if disabled.

php phpinfo, line-display-phpinfo-page-by-page. Is there a way to force phpinfo() to output its stuff without formatting. Just like in CLI mode? layout. Tags: php� The solution is as simple as turning on output buffering, capturing the echo'ed value of phpinfo (); and then using preg_replace to only return what's in between the <body></body> tags.

This function does a great job at converting phpinfo into an array.

function parse_phpinfo() {
    ob_start(); phpinfo(INFO_MODULES); $s = ob_get_contents(); ob_end_clean();
    $s = strip_tags($s, '<h2><th><td>');
    $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', '<info>\1</info>', $s);
    $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', '<info>\1</info>', $s);
    $t = preg_split('/(<h2[^>]*>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
    $r = array(); $count = count($t);
    $p1 = '<info>([^<]+)<\/info>';
    $p2 = '/'.$p1.'\s*'.$p1.'\s*'.$p1.'/';
    $p3 = '/'.$p1.'\s*'.$p1.'/';
    for ($i = 1; $i < $count; $i++) {
        if (preg_match('/<h2[^>]*>([^<]+)<\/h2>/', $t[$i], $matchs)) {
            $name = trim($matchs[1]);
            $vals = explode("\n", $t[$i + 1]);
            foreach ($vals AS $val) {
                if (preg_match($p2, $val, $matchs)) { // 3cols
                    $r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3]));
                } elseif (preg_match($p3, $val, $matchs)) { // 2cols
                    $r[$name][trim($matchs[1])] = trim($matchs[2]);
    return $r;

PHP: The Right Way, Learn about the built-in, command line web server The solutions listed above mainly handle PHP itself, and do not supply things like Apache, Nginx or a SQL server. code directly without having to create and secure a web GUI for it. The -i option will print your PHP configuration just like the phpinfo()� To view phpinfo() output on our servers, you must have an A2 Hosting account. The information revealed by the phpinfo() function poses a potential security risk, so we do not post it publicly. Hackers and other malicious actors could use the information from phpinfo() to plan an attack.

If your host allows you to use exec() you can output it the same way as on CLI like this:

exec('php -i', $data);

Be aware that this would show the info the same as on CLI, it knows nothing about the webserver.

PHP Logging Basics - The Ultimate Guide To Logging, This guide explores the basics of logging in PHP including how to configure how the PHP engine can be configured to display and log error output. whether it's on the CLI or behind a web server such as Apache or Nginx. Set to zero for no maximum. In your code, use the trigger_error() function for custom errors. Questions: My PHP web application requires files (about 2.5 to 3 GB in size) to be uploaded to the server. How will this impact on following directives ? what are the required values in my case? post_max_size upload_max_filesize memory_limit Your help will greatly be appreciated.

TCL equivalent of PHP "phpinfo()"?, I am seeking the equivalent of PHP's "phpinfo()" command that dumps info), only for TCL. I want a way of foreach var [info globals] { global $var }; # FORCE ALL VARS WITHIN It's a great proc, Roy, but I have no clue as to how to use it having to do command-line anything except the occasional simple Unix stuff. 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.

Linux 25 PHP Security Best Practices For Sys Admins, Here are twenty-five php security best practices for Linux and Unix sysadmins for You can download php source code from and compile it as follows with GD, To enable or disable a particular module, just find the configuration file in PhpSecInfo provides an equivalent to the phpinfo() function that reports� Hi, I am having an issue with the php copy function and wanted to check some system variables, but for some reason phpinfo() will not output any data. phpis working on the server, (Apache), and the print statement outputs to the browser OK, but otherwise a blank screen.

"White screen of death" (WSOD) / HTTP Error 500, No errors. Nothing. This happens sometimes, It could happen after updating a Another way to force errors to display is to change the shutdown handler. Next, you'll want to confirm that the change has had an effect with a phpinfo() page. If you have just enabled or disabled node access module and get the WSOD� PowerShell commands are known as cmdlets, and these cmdlets are the driving force behind its functional capabilities. From commands that improve the overall Windows experience to commands useful for development work, there are dozens of important commands developers should know.