code: function checkServer(hostname, port, cb) {
        const self = this;
        //console.log(`[${this.counter}] checkServer`);
  
        if (self.status !== Status.STARTING) return;
  
        setTimeout(function _checkServer_fire() {
          http.request({
            method: 'HEAD',
            hostname: hostname,
            port: port
          }, function _checkServer_httpCallback(res) {
            const statusCodeType = Number(res.statusCode.toString()[0]);
  
            if ([2, 3, 4].indexOf(statusCodeType) !== -1) {
              return cb(true);
            } else if (statusCodeType === 5) {
              console.log(
                'Server docroot returned 500-level response. Please check ' +
                'your configuration for possible errors.'
              );
              return cb(true);
            }
  
            checkServer.call(self, hostname, port, cb);
          }).on('error', function _checkServer_httpError(err) {
            // back off after 1s
            if (++self.checkServerTries > 20) {
              console.log('PHP server not started. Retrying...');
              return cb(false);
            }
            checkServer.call(self, hostname, port, cb);
          }).end();
        }, 15);
      }
docs: Private: Check wherther the server is running.
  @param hostname
  @param port
  @param cb