/** * @param string $host 127.0.0.1:9000 or /var/run/php5-fpm.sock * @param string $tempDir */ public function __construct($host = null, $tempDir = null) { // try to guess where it is if ($host === null) { if (file_exists('/var/run/php5-fpm.sock')) { $host = '/var/run/php5-fpm.sock'; } else { $host = '127.0.0.1:9000'; } } if (false !== strpos($host, ':')) { list($host, $port) = explode(':', $host); $this->client = new Client($host, $port); } else { // socket $this->client = new Client('unix://' . $host, -1); } $this->client->setReadWriteTimeout(60 * 1000); $this->client->setPersistentSocket(false); $this->client->setKeepAlive(true); }