def startServer(self): php = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver']) port = 8999 host = 'localhost' public = os.path.join(self.config.dir['ptproject'],self.config.dir['public']) ini_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_ini']) router_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_router']) if getPidByPort(port): killPidByPort(port) hostPort = "%s:%d" % (host,port) self.config.ptUrl = url = "http://" +hostPort cmd ="%s -S %s -c %s -t %s %s" % (php,hostPort,ini_file,public,router_file) print cmd subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
def startServer(self): php = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver']) port = int(self.config.setting['port']) host = self.config.setting['host'] public = os.path.join(self.config.dir['ptproject'],self.config.dir['public']) ini_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_ini']) router_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_router']) #如果 port 已启用 先KILL if getPidByPort(port): #print "port has runnint" killPidByPort(port) hostPort = "%s:%d" % (host,port) self.config.ptUrl = url = "http://" +hostPort cmd ="%s -S %s -c %s -t %s %s" % (php,hostPort,ini_file,public,router_file) subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
def _stop(self,port): killPidByPort(port)