note 87214 added to function.phpinfo

From: Date: Tue, 25 Nov 2008 05:19:27 +0000
Subject: note 87214 added to function.phpinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-146900@lists.php.net to get a copy of this message
My hosting company doesn't let me edit my php.ini file, but I wanted most of the same values, so I adapted one of the above posts to let me convert the information from phpinfo into a page where so can just copy and paste the info into a new php.ini file. <?php ob_start(); phpinfo(INFO_CONFIGURATION); $phpinfo = array('phpinfo' => array()); if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) foreach($matches as $match) if(strlen($match[1])) $phpinfo[$match[1]] = array(); elseif(isset($match[3])) $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; else $phpinfo[end(array_keys($phpinfo))][] = $match[2]; ?> <?php foreach($phpinfo as $name => $section) { foreach($section as $key => $val) { if(is_array($val)) echo "$key = $val[0]<br>"; elseif(is_string($key)) echo "$key = $val<br>"; else echo "$val<br>"; } echo "\n"; } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 98.19.32.178 ---- Manual Page -- http://www.php.net/manual/en/function.phpinfo.php Edit -- https://master.php.net/note/edit/87214 Del: integrated -- https://master.php.net/note/delete/87214/integrated Del: useless -- https://master.php.net/note/delete/87214/useless Del: bad code -- https://master.php.net/note/delete/87214/bad+code Del: spam -- https://master.php.net/note/delete/87214/spam Del: non-english -- https://master.php.net/note/delete/87214/non-english Del: in docs -- https://master.php.net/note/delete/87214/in+docs Del: other reasons-- https://master.php.net/note/delete/87214 Reject -- https://master.php.net/note/reject/87214 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146900) next »