### Home Classes Methods

### In Files

- lib/phusion_passenger/platform_info/apache_detector.rb

### Parent

Object

### Namespace

- CLASS PhusionPassenger::PlatformInfo::ApacheDetector::Result

### Methods

- ::new
- #detect_all
- #detect_one
- #finish
- #report

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::ApacheDetector
- PhusionPassenger::PlatformInfo::ApacheDetector::Result
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::RuntimeLocator
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::GeneratorTest
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::JSON
- PhusionPassenger::Utils::JSON::Generator
- PhusionPassenger::Utils::ParserTest
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::PlatformInfo::ApacheDetector

Detects all possible Apache installations on the system, and presents the autodetection information to the user in a friendly way. It turns out too many people have multiple Apache installations on their system, but they don't know about that, or they don't know how to compile against the correct Apache installation. This tool helps them.

### Public Class Methods

new(output) click to toggle source

    # File lib/phusion_passenger/platform_info/apache_detector.rb, line 79
    def initialize(output)
            @output  = output
            @results = []
            PlatformInfo.verbose = true
            PlatformInfo.log_implementation = lambda do |message|
                    if message =~ /: found$/
                            log("<green> * #{message}</green>")
                    else
                            log(" * #{message}")
                    end
            end
    end

### Public Instance Methods

detect_all() click to toggle source

    # File lib/phusion_passenger/platform_info/apache_detector.rb, line 97
    def detect_all
            log "<banner>Looking for possible Apache installations...</banner>"
            apxses = PlatformInfo.find_all_commands("apxs2") +
                    PlatformInfo.find_all_commands("apxs")
            apxses = remove_symlink_duplications(apxses)
            log ""
            apxses.each do |apxs2|
                    detect_one(apxs2)
            end
    end

detect_one(apxs2) click to toggle source

    # File lib/phusion_passenger/platform_info/apache_detector.rb, line 108
    def detect_one(apxs2)
            log "<banner>Analyzing #{apxs2}...</banner>"
            add_result do |result|
                    result.apxs2 = apxs2
                    log "Detecting main Apache executable..."
                    result.httpd = PlatformInfo.httpd(:apxs2 => apxs2)
                    if result.httpd
                            if result.version = PlatformInfo.httpd_version(:httpd => result.httpd)
                                    log "Version detected: #{result.version}"
                            else
                                    log "<red>Cannot detect version!</red>"
                                    result.httpd = nil
                            end
                    end
                    if result.httpd
                            log "Detecting control command..."
                            result.ctl = PlatformInfo.apache2ctl(:apxs2 => apxs2)
                            result.httpd = nil if !result.ctl
                    end
                    if result.httpd
                            result.config_file = PlatformInfo.httpd_default_config_file(:httpd => result.httpd)
                            if result.config_file
                                    log "Default config file location detected: #{result.config_file}"
                            else
                                    log "<red>Cannot detect default config file location!</red>"
                                    result.httpd = nil
                            end
                    end
                    if result.httpd
                            result.error_log = PlatformInfo.httpd_actual_error_log(:httpd => result.httpd)
                            if result.error_log
                                    log "Error log file detected: #{result.error_log}"
                            else
                                    log "<red>Cannot detect error log file!</red>"
                                    result.httpd = nil
                            end
                    end
                    if result.httpd
                            if PlatformInfo.httpd_supports_a2enmod?(:httpd => result.httpd)
                                    log "This Apache installation does not support a2enmod."
                            else
                                    log "Detecting a2enmod and a2dismod..."
                                    result.a2enmod = PlatformInfo.a2enmod(:apxs2 => apxs2)
                                    result.a2dismod = PlatformInfo.a2dismod(:apxs2 => apxs2)
                            end
                    end
                    if result.httpd
                            log "<green>Found a usable Apache installation using #{apxs2}.</green>"
                            true
                    else
                            log "<yellow>Cannot find a usable Apache installation using #{apxs2}.</yellow>"
                            false
                    end
            end
            log ""
    end

finish() click to toggle source

    # File lib/phusion_passenger/platform_info/apache_detector.rb, line 92
    def finish
            PlatformInfo.verbose = false
            PlatformInfo.log_implementation = nil
    end

report() click to toggle source

    # File lib/phusion_passenger/platform_info/apache_detector.rb, line 165
    def report
            log "<banner>Final autodetection results</banner>"
            @results.each do |result|
                    result.report
            end
            if @results.empty?
                    log "<red>Sorry, this program cannot find an Apache installation.</red>"
                    log ""
                    log "To install Apache, please run the following. It will tell you how to install Apache."
                    log ""
                    log "   <b>#{PhusionPassenger.bin_dir}/passenger-install-apache2-module</b>"
                    log ""
                    log "If you are sure that you have Apache installed, please read the documentation:"
                    log " * <b>#{PhusionPassenger.doc_dir}/Users guide Apache.html</b>, section"
                    log "   section 'Installation' -> 'Customizing the compilation process' ->"
                    log "   'Forcing location of command line tools and dependencies'"
                    log " * Or visit the online version:"
                    log "   <b>http://www.modrails.com/documentation/Users%20guide%20Apache.html#_forcing_location_of_command_line_tools_and_dependencies</b>"
            elsif @results.size > 1
                    log "<yellow>WARNING: You have multiple Apache installations on your system!</yellow>"
                    log "You are strongly recommended to read this section of the documentation:"
                    log " * <b>#{PhusionPassenger.doc_dir}/Users guide Apache.html</b>, section"
                    log "   section 'Installation' -> 'Customizing the compilation process' ->"
                    log "   'Forcing location of command line tools and dependencies'"
                    log " * Or visit the online version:"
                    log "   <b>http://www.modrails.com/documentation/Users%20guide%20Apache.html#_forcing_location_of_command_line_tools_and_dependencies</b>"
            end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.