|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34017 CLI php.exe should allow HTML with phpinfo()
Submitted: 2005-08-06 13:52 UTC Modified: 2018-07-04 01:21 UTC
Avg. Score:4.0 ± 0.7
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: csaba at alum dot mit dot edu Assigned: kalle (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 5.1.0b3 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: csaba at alum dot mit dot edu
New email:
PHP Version: OS:


 [2005-08-06 13:52 UTC] csaba at alum dot mit dot edu
Using CLI php.exe or php-win.exe on Windows, it is a perfectly reasonable thing to use COM to bring up Internet Explorer.  In fact, it makes a lot of sense to use it strictly as a graphical output (or I/O) mechanism.  Unfortunately, phpinfo() from these versions of php does not allow the option of outputting with HTML.  Since COM is now supported in PHP5, it seems that wanting CLI output of phpinfo() to go to a browser will become more common.

I would therefore like to suggest that either:
(1) phpinfo() respect the html_errors setting or
(2) phpinfo() take a second, optional argument, which, if supplied and non false, would lead to phpinfo() outputting HTML for CLI php and withholding the HTML for non CLI php.

Csaba Gabor from Vienna

Note.  Running the attached code with php-cgi.exe will illustrate what I would like: formatted phpinfo() appearing in IE.  But I'd like it to work with php.exe and php-win.exe, too.

Reproduce code:
    // bring up IE (from CLI php.exe)
    $ie = new COM("InternetExplorer.Application");
    $ie->visible = true;

    // try to get formatted phpinfo();
    ini_set("html_errors", "1");
    $phpinfo = ob_get_contents();

    // output it to IE

Expected result:
I would expect to get formatted phpinfo() with the supplied code example, but I only get raw phpinfo().


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 22:59 UTC]
-Package: Feature/Change Request +Package: PHP options/info functions
 [2017-08-23 00:49 UTC]
This is a plain limitation within the SAPI struct, that sets phpinfo_as_text to 1 for some SAPIs and there is no way to directly control it. I don't think we should let allow userland to change this.

What you can do is to invoke php-cgi.exe and strip the headers and then put the output in a HTML file.

You can do something like (not tested):

$tmp = tmpfile();
file_put_contents($tmp, '<?php phpinfo(); ?>');

$phpinfo = `php-cgi -q "$tmp"`;

 [2017-08-23 00:49 UTC]
-Status: Open +Status: Analyzed
 [2018-07-04 01:21 UTC]
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: kalle
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 24 14:03:44 2021 UTC