
cherokee at cherokee-project
Oct 13, 2009, 6:32 PM
Post #1 of 1
(116 views)
Permalink
|
|
[3701] cherokee/trunk/admin: Better "localhost" IP address detection.
|
|
Revision: 3701 http://svn.cherokee-project.com/changeset/3701 Author: aperez Date: 2009-10-14 03:32:29 +0200 (Wed, 14 Oct 2009) Log Message: ----------- Better "localhost" IP address detection. Modified Paths: -------------- cherokee/trunk/admin/Wizard_PHP.py cherokee/trunk/admin/util.py Modified: cherokee/trunk/admin/Wizard_PHP.py =================================================================== --- cherokee/trunk/admin/Wizard_PHP.py 2009-10-14 01:05:12 UTC (rev 3700) +++ cherokee/trunk/admin/Wizard_PHP.py 2009-10-14 01:32:29 UTC (rev 3701) @@ -64,11 +64,15 @@ desc = "<p>%s: %s.</p>" % (msg, ", ".join(DEFAULT_BINS)) return self.report_error (_("Couldn't find a suitable PHP interpreter."), desc) + tcp_addr = cfg_source_get_localhost_addr() + if not tcp_addr: + return self.report_error (_("Couldn't find IP address for 'localhost'")) + _, self.source = cfg_source_get_next (self._cfg) self._cfg['%s!nick' % (self.source)] = 'PHP Interpreter' self._cfg['%s!type' % (self.source)] = 'interpreter' - self._cfg['%s!interpreter' % (self.source)] = '%s -b 127.0.0.1:%d' % (php_path, self.TCP_PORT) - self._cfg['%s!host' % (self.source)] = '127.0.0.1:%d' % (self.TCP_PORT) + self._cfg['%s!interpreter' % (self.source)] = '%s -b %s:%d' % (php_path, tcp_addr, self.TCP_PORT) + self._cfg['%s!host' % (self.source)] = '%s:%d' % (tcp_addr, self.TCP_PORT) self._cfg['%s!env!PHP_FCGI_MAX_REQUESTS' % (self.source)] = "5000" self._cfg['%s!env!PHP_FCGI_CHILDREN' % (self.source)] = "5" Modified: cherokee/trunk/admin/util.py =================================================================== --- cherokee/trunk/admin/util.py 2009-10-14 01:05:12 UTC (rev 3700) +++ cherokee/trunk/admin/util.py 2009-10-14 01:32:29 UTC (rev 3701) @@ -96,8 +96,12 @@ s.close() return port +def cfg_source_get_localhost_addr (): + _, _, addrs = socket.gethostbyname_ex('localhost') + if addrs: + return addrs[0] + return None - # # Paths #
|