Re: grep leads me to an idea; php-ini.xml

From: Date: Wed, 02 Apr 2003 11:37:40 +0000
Subject: Re: grep leads me to an idea; php-ini.xml
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14785@lists.php.net to get a copy of this message
you could probably do it with output buffering phpinfo(), and preg_match. Regards Alan Urs Gehrig wrote:
hello just a few posts ago, i read this thing about using grep to parse the php.ini path. i had this idea to put php.ini in an xml file for some days and found a solution with wddx. having no a way to grab the real php.ini path makes it even more automatic. so here is my unconvetional way of moving php.ini into xml: <?php if(stristr(exec("which grep"), "Command not found") != 1) { $ini_html = exec("php -i | grep php.ini" ); $ini_arr = explode("</td>", $ini_html ); $ini_path = strip_tags(trim($ini_arr[1]) ); $ini_vals = parse_ini_file($ini_path ); $packet_id = wddx_packet_start($ini_path ); wddx_add_vars($packet_id, "ini_vals"); echo $xml = wddx_packet_end($packet_id); } else {
   echo "There is no grep or no which either.\n";    }
?> C:\php>php -f ini2xml.php > php-ini.xml what you do with it is up to you ;-) -urs
-----Original Message----- From: Alan Knowles [mailto:alan@akbkhome.com] Sent: Wednesday, April 02, 2003 12:40 PM Subject: Re: [PEAR-DEV] Re: [PEAR] DataObjects: problem connecting to php -i | grep ini Configuration File (php.ini) Path => /etc/php4/apache/php.ini
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#14785) next »