Re: grep leads me to an idea; php-ini.xml
| From: | Bertrand Mansion | Date: | Wed, 02 Apr 2003 11:57:26 +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-14786@lists.php.net to get a copy of this message | ||
<urs@circle.ch> 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
Hi Urs,
Converting ini to xml using the Config 1.4 package:
$config = new Config();
$root =& $config->parseConfig($ini_path, 'inifile');
echo $root->toString('xml', array('name' => 'phpini'));
Easy :)
Bertrand Mansion
Mamasam
>> -----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
>
>