public static function init()
{
/* Run constructor now because it requires $_SERVER['SERVER_NAME'] to
* be empty if called with a CGI SAPI. */
$cli = new static();
@set_time_limit(0);
ob_implicit_flush(true);
ini_set('html_errors', false);
set_exception_handler(array($cli, 'fatal'));
if (!isset($_SERVER['HTTP_HOST'])) {
$_SERVER['HTTP_HOST'] = '127.0.0.1';
}
if (!isset($_SERVER['SERVER_NAME'])) {
$_SERVER['SERVER_NAME'] = '127.0.0.1';
}
if (!isset($_SERVER['SERVER_PORT'])) {
$_SERVER['SERVER_PORT'] = '';
}
if (!isset($_SERVER['REMOTE_ADDR'])) {
$_SERVER['REMOTE_ADDR'] = '';
}
$_SERVER['PHP_SELF'] = isset($argv) ? $argv[0] : '';
if (!defined('STDIN')) {
define('STDIN', fopen('php://stdin', 'r'));
}
if (!defined('STDOUT')) {
define('STDOUT', fopen('php://stdout', 'r'));
}
if (!defined('STDERR')) {
define('STDERR', fopen('php://stderr', 'r'));
}
return $cli;
}