Req #66260 [NEW]: Provide phpinfo() alternative that returns array

From: Date: Wed, 11 Dec 2013 02:52:02 +0000
Subject: Req #66260 [NEW]: Provide phpinfo() alternative that returns array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183234@lists.php.net to get a copy of this message
From:             preinheimer
Operating system: All
PHP version:      Irrelevant
Package:          Unknown/Other Function
Bug Type:         Feature/Change Request
Bug description:Provide phpinfo() alternative that returns array

Description:
------------
There's several reasons to want an easily parsed phpinfo() output, chief
amongst them to ensure that a series of servers have the same packages,
and are configured in the same manner. There's a series of solutions[1]
built on top of using the output from phpinfo(), then parsing it back
into arrays. Clearly this is sub-optimal.

A userland alternative would be to run through the various functions
like ini_get(), get_loaded_extensions(), etc. But not quite as pretty,
I'm not sure if the same level of information is even exposed there
(phpinfo() shows me master, and current, can I get that from
ini_get())?



[1] like http://php.net/phpinfo#84259

Test script:
---------------
$config = phpinfo(-1, TRUE);
echo json_encode($config);


Expected result:
----------------
A beautiful json output of the PHP's server configuration. I'd then be
able to use PHP's glorious array functions to easily compare it to
another server's and find problems. 

Actual result:
--------------
Hrm, this seems like the kind of question I'd see on a test. phpinfo()
will error because it's not expecting the second parameter, so I'll run
with C) error. 

-- 
Edit bug report at https://bugs.php.net/bug.php?id=66260&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66260&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66260&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66260&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66260&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66260&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66260&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66260&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66260&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66260&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66260&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66260&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66260&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66260&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66260&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66260&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66260&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66260&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66260&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66260&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66260&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#183234) next »