FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
swoole_framework/examples/app_server.php at master · garming/swoole_framework · GitHub
garming
swoole_framework
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
swoole_framework
/
examples
/
app_server.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (22 loc) · 987 Bytes
Breadcrumbs
swoole_framework
/
examples
/
app_server.php
Copy path
File metadata and controls
26 lines (22 loc) · 987 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
define
(
'
DEBUG
'
,
'
on
'
);
define
(
"
WEBPATH
"
,
realpath
(
__DIR__
.
'
/../
'
));
require
__DIR__
.
'
/../libs/lib_config.php
'
;
//require __DIR__'/phar://swoole.phar';
Swoole
\Config::
$
debug
=
false
;
$
AppSvr
=
new
Swoole
\
Network
\
Protocol
\
AppServer
();
$
AppSvr
->
loadSetting
(
__DIR__
.
'
/swoole.ini
'
);
//加载配置文件
$
AppSvr
->
setAppPath
(
WEBPATH
.
'
/apps/
'
);
//设置应用所在的目录
$
AppSvr
->
setDocumentRoot
(
WEBPATH
);
$
AppSvr
->
setLogger
(
new
\
Swoole
\
Log
\
FileLog
(
__DIR__
.
"
/webserver.log
"
));
//Logger
Swoole
\Error::
$
echo_html
=
true
;
/**
* 如果你没有安装swoole扩展,这里还可选择
* BlockTCP 阻塞的TCP,支持windows平台
* SelectTCP 使用select做事件循环,支持windows平台
* EventTCP 使用libevent,需要安装libevent扩展
*/
$
server
=
new
\
Swoole
\
Network
\
Server
(
'
0.0.0.0
'
,
8888
);
$
server
->
setProtocol
(
$
AppSvr
);
//$server->daemonize(); //作为守护进程
$
server
->
run
(
array
(
'
worker_num
'
=>
8
,
'
max_request
'
=>
5000
,
'
log_file
'
=>
'
/tmp/swoole.log
'
));
Back
|
FazBrowse Home
|
New Git URL