Jump to content
The Uniform Server Community
Sign in to follow this  
page2pagepro

Proposed Improved PHPINFO() with Loaded Extensions information

Recommended Posts

Purpose is to improve the native phpinfo() function to something a bit more specialized.

  • Assumed %top% to be UniServer Root Installation folder/directory

  1. Replace code in file %top%\home\admin\www\phpinfo.php with:
  2. <?php
    /**************************************************************************\
    	Contributors:
    		http://nevstokes.com/blog/2009/06/23/a-better-phpinfo/
    		http://www.page2pagepro.com/a-better-phpinfo/
    \**************************************************************************/
    
    $options = array('CONFIGURATION', 'ENVIRONMENT', 'MODULES', 'EXTENSIONS', 'VARIABLES', 'GENERAL', 'CREDITS', 'LICENSE', 'ALL');
    $display = (empty($_GET['display']) || !in_array(strtoupper($_GET['display']), $options)) ? 'ALL' : strtoupper($_GET['display']);
    
    $navigation = array();
    
    foreach($options as $key=>$value) {
    	$navigation[] = ($value != $display) ? '<a href="' . $_SERVER['SCRIPT_NAME'] . '?display=' . $value . '">' . $value . '</a>' : '<strong>' . $value . '</strong>';
    }
    
    ob_start();
    
    switch($display) {
    	case 'CONFIGURATION':		
    		phpinfo(INFO_CONFIGURATION);
    		break;
    
    	case 'ENVIRONMENT':
    		phpinfo(INFO_ENVIRONMENT);
    		break;
    
    	case 'MODULES':
    		phpinfo(INFO_MODULES);
    		break;
    
    	case 'VARIABLES':
    		phpinfo(INFO_VARIABLES);
    		break;
    
    	case 'GENERAL':
    		phpinfo(INFO_GENERAL);
    		break;
    
    	case 'EXTENSIONS':
    	case 'CREDITS':
    		phpinfo(INFO_CREDITS);
    		break;
    
    	case 'LICENSE':
    		phpinfo(INFO_LICENSE);
    		break;
    
    	case 'ALL': default:
    		phpinfo();
    		break;
    }
    
    $content = ob_get_clean();
    
    if (($display) == 'EXTENSIONS') {
    	$str = '<body><div class="center">';
    	$content = substr($content, 0, strpos("$content$str", $str)+strlen($str));
    	ob_start();
    	echo '<h2>Overview</h2>'.PHP_EOL;
    	echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL;
    	echo '<tr><td class="e">Extensions</td><td class="v">'.PHP_EOL;
    	$exts = array();
    	foreach (get_loaded_extensions() as $ext) {
    		$exts[] = $ext;
    	}
    	echo implode(', ', $exts).PHP_EOL;
    	echo '</td></tr></table><br />'.PHP_EOL;
    	echo '<h2>Details</h2>'.PHP_EOL;
    	echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL;
    	foreach ($exts as $ext) {
    		echo '<tr><td class="e">'.$ext.'</td><td class="v">';
    			$funcs = array();
    			foreach (get_extension_funcs($ext) as $func) {
    				$funcs[] = $func;
    			}
    			echo implode(', ', $funcs).PHP_EOL;
    		echo '</td></tr>'.PHP_EOL;
    	}
    	echo '</table><br />'.PHP_EOL;
    	echo '</div></body></html>'.PHP_EOL;
    	$content .= ob_get_contents();
    	ob_end_clean();		
    }
    
    echo str_replace('<body>', '</body><body><div class="center options"><p>' . implode(' | ', $navigation) .'</p></div>', $content);
    ?>


  3. Code is found with syntax-highlighting (Geshi) at Page2PagePro.com

Please let me know if you have any other additions to this project.

 

Thanx!

Share this post


Link to post
Share on other sites

Yep! Excellent feature, tested on 5 Series will add with minor changes (menu lower case)

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...