Skip to content

n2ref/apache_config_parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Apache config parser

Parse apache config

Example

require_once('Apache_Config_Parser.php');

$server_apache_config = '/etc/apache2/apache2.conf';

$apache_config_parser = new Apache_Config_Parser($server_apache_config);
$apache_hosts         = $apache_config_parser->getApacheHosts();

echo'<pre>';print_r($apache_hosts);echo'</pre>';

Result

Array (
    [host1.com] => Array (
        [is_active] => 1
        [document_root] => /home/username1/www/host1.com
        [aliases] => Array (
            0 => Array (
                [name] => www.host1.com
                [is_active] => 1
            )
            1 => Array (
                [name] => h1.com
                [is_active] => 1
            )
        )
    )

    [host2.com] => Array (
        [is_active] => 1
        [document_root] => /home/username2/www/host2.com
        [aliases] => Array (
        )
    )

    [host3.com] => Array (
        [is_active] => 1
        [document_root] => /home/username2/www/host2.com
        [aliases] => Array (
        )
    )
    
    ...
    
)        

Releases

No releases published

Packages

No packages published

Languages