Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache config parser for PHP

Tags:

php

apache

I am looking for some PHP utility that parses Apache configuration files similar to this Perl's module: http://metacpan.org/pod/Apache::ConfigParser

Any clues?

like image 386
Raisen Avatar asked Oct 30 '25 08:10

Raisen


1 Answers

PEAR::Config supports Apache-style config files.
Have a look at the manual http://pear.php.net/manual/en/package.configuration.config.avail-container.apache.php

$conf = new Config();
$root = $conf->parseConfig("/etc/apache2/httpd.conf", "apache");
print current($root->getItem('directive', 'Listen'))->content;

Or something like that..

like image 91
mario Avatar answered Oct 31 '25 22:10

mario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!