/** * Options: * document_root: Path to the document root. * server_root: Path to the directory to be used as the server root. * error_log: * access_log: * httpd_conf: Path to the httpd.conf file that will be generated. * logger: PSR3 Logger. * executable: Full path to the httpd or apache2 executable. * port: Port for apache to listen on. * log_level: Apache log level. * template: Filename of the template to be used for rendering the httpd.conf. * modules: Array of module files, keyed by module name, e.g. php5_module => libphp5.so. * module_finder: ModuleFinder service. * module_paths: Additional paths for use by the module_finder service. */ public function __construct() { // Default values. $this['cwd'] = $this->share(function ($container) { return posix_getcwd(); }); $this['home'] = $this->share(function ($container) { return getenv('HOME'); }); // Parameters $this['document_root'] = '%cwd%'; $this['server_root'] = '%cwd%/.feather'; $this['error_log'] = '%server_root%/error_log'; $this['access_log'] = '%server_root%/access_log'; $this['httpd_conf'] = '%server_root%/httpd.conf'; $this['port'] = 8080; $this['log_level'] = 'info'; $this['template'] = 'default.conf'; $this['modules'] = array("authz_host_module" => "mod_authz_host.so", "dir_module" => "mod_dir.so", "env_module" => "mod_env.so", "mime_module" => "mod_mime.so", "log_config_module" => "mod_log_config.so", "rewrite_module" => "mod_rewrite.so", "php5_module" => "libphp5.so"); $this['module_paths'] = array(); $this['executable'] = $this->share(function ($container) { $finder = $container['executable_finder']; $names = array('httpd', 'apache2'); if (!($executable = $finder->find($names))) { throw new \RuntimeException(sprintf('Unable to locate an executable named %s', join(', ', $names))); } return $executable; }); // Services $this['logger'] = $this->share(function ($container) { return new NullLogger(); }); $this['executable_finder'] = $this->share(function ($container) { return new MultiExecutableFinder(); }); $this['module_finder'] = $this->share(function ($container) { $finder = new ModuleFinder(); $finder->addPaths($container['module_paths']); return $finder; }); }
/** * This test is intended to validate the default module paths, and help * identify systems and configurations that are not yet supported. */ public function testDefaultModulePaths() { $finder = new ModuleFinder(); $found = $finder->find('mod_dir.so'); $this->assertTrue(!empty($found)); }