芝麻web文件管理V1.00
编辑当前文件:/home/strato/chroot/opt/RZphp80/includes/doc/Config/docs/Apache.php
* @package Config */ // $Id: Apache.php 120908 2003-03-22 17:44:12Z mansion $ require_once('Config.php'); $datasrc = '/path/to/httpd.conf'; $conf = new Config(); $content =& $conf->parseConfig($datasrc, 'apache'); if (PEAR::isError($content)) { die($content->getMessage()); } // adding a new virtual-host $content->createBlank(); $content->createComment('My virtual host'); $content->createBlank(); $vhost =& $content->createSection('VirtualHost', array('127.0.0.1:82')); $vhost->createDirective('DocumentRoot', '/usr/share/www'); $vhost->createDirective('ServerName', 'www.mamasam.com'); $location =& $vhost->createSection('Location', array('/admin')); $location->createDirective('AuthType', 'basic'); $location->createDirective('Require', 'group admin'); // adding some directives Listen if ($listen =& $content->getItem('directive', 'Listen')) { $res =& $content->createDirective('Listen', '82', null, 'after', $listen); } else { $listen =& $content->createDirective('Listen', '81', null, 'bottom'); if (PEAR::isError($listen)) { die($listen->getMessage()); } $content->createDirective('Listen', '82', null, 'after', $listen); } echo '
'.htmlspecialchars($content->toString('apache')).'
'; // Writing the files /* if (!PEAR::isError($write = $conf->writeConfig('/tmp/httpd.conf', 'apache'))) { echo 'done writing config
'; } else { die($write->getMessage()); } if ($vhost->writeDatasrc('/tmp/vhost.conf', 'apache')) { echo 'done writing vhost
'; } */ ?>