Req #34017 [Opn]: CLI php.exe should allow HTML with phpinfo()
| From: | kalle@php.net | Date: | Wed, 23 Aug 2017 00:49:33 +0000 |
| Subject: | Req #34017 [Opn]: CLI php.exe should allow HTML with phpinfo() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210777@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=34017&edit=1
ID: 34017
Updated by: kalle@php.net
Reported by: csaba at alum dot mit dot edu
Summary: CLI php.exe should allow HTML with phpinfo()
Status: Open
Type: Feature/Change Request
Package: PHP options/info functions
Operating System: Windows
PHP Version: 5.1.0b3
Block user comment: N
Private report: N
New Comment:
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";
fclose($fmp);
Previous Comments:
------------------------------------------------------------------------
[2005-08-06 13:52:49] csaba at alum dot mit dot edu
Description:
------------
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.
Thanks,
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:
---------------
<?php
// bring up IE (from CLI php.exe)
$ie = new COM("InternetExplorer.Application");
$ie->Navigate("about:blank");
$ie->visible = true;
// try to get formatted phpinfo();
ini_set("html_errors", "1");
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
// output it to IE
$ie->Document->Write($phpinfo);
?>
Expected result:
----------------
I would expect to get formatted phpinfo() with the supplied code example, but I only get raw
phpinfo().
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=34017&edit=1