/** * Return command used to start the standalone server. * * @return string */ public function getCommand() { $port = $this->config->getPort(); $java_bin = $this->config->getJavaBin(); $jars = []; $classpaths = $this->config->getClasspaths(); foreach ($classpaths as $classpath) { if (preg_match('/\\*\\.jar$/', $classpath)) { $directory = preg_replace('/\\*\\.jar$/', '', $classpath); $files = glob("{$directory}/*.jar"); foreach ($files as $file) { foreach ($files as $file) { $jars[] = $file; } } } else { $jars[] = $classpath; } } $jars[] = $this->config->getServerJar(); $classpath = implode(':', $jars); $threads = $this->config->getThreads(); $directives = ' -D' . implode(' -D', ['php.java.bridge.daemon="false"', "php.java.bridge.threads={$threads}"]); $command = sprintf('%s -cp "%s" %s php.java.bridge.Standalone SERVLET:%d', $java_bin, $classpath, $directives, $port); return $command; }
/** * @param ConsoleLogger $logger * @param Config $config */ public function logServerConfig(ConsoleLogger $logger, Config $config) { $logger->info("* config port :" . $config->getPort()); $logger->info("* config log_file :" . $config->getLogFile()); $logger->info("* config pid_file :" . $config->getPidFile()); $logger->info("* config classpaths :" . implode(',', $config->getClasspaths())); $logger->info("* config java_bin :" . $config->getJavaBin()); $logger->info("* config server_jar :" . $config->getServerJar()); }