hyperf-chat/bin/hyperf.php

28 lines
841 B
PHP
Raw Normal View History

2020-11-02 22:45:37 +08:00
#!/usr/bin/env php
<?php
2021-09-04 14:25:39 +08:00
ini_set('memory_limit', '1024M');
2020-11-02 22:45:37 +08:00
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
2021-09-04 14:25:39 +08:00
!defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
!defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
2020-11-02 22:45:37 +08:00
require BASE_PATH . '/vendor/autoload.php';
2021-10-09 10:43:28 +08:00
2020-11-08 22:58:17 +08:00
// 设置服务运行ID
define('SERVER_RUN_ID', uniqid());
2020-11-02 22:45:37 +08:00
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
(function () {
Hyperf\Di\ClassLoader::init();
/** @var \Psr\Container\ContainerInterface $container */
$container = require BASE_PATH . '/config/container.php';
$application = $container->get(\Hyperf\Contract\ApplicationInterface::class);
$application->run();
})();