FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/examples/http_server.php at master · oyxhm/framework · GitHub
oyxhm
framework
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
examples
/
http_server.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (23 loc) · 895 Bytes
Breadcrumbs
framework
/
examples
/
http_server.php
Copy path
File metadata and controls
27 lines (23 loc) · 895 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
27
<?php
define
(
'
DEBUG
'
,
'
on
'
);
define
(
"
WEBPATH
"
,
realpath
(
__DIR__
.
'
/../
'
));
require
dirname
(
__DIR__
) .
'
/libs/lib_config.php
'
;
Swoole
\Config::
$
debug
=
false
;
//设置PID文件的存储路径
Swoole
\
Network
\Server::
setPidFile
(
__DIR__
.
'
/http_server.pid
'
);
/**
* 显示Usage界面
* php app_server.php start|stop|reload
*/
Swoole
\
Network
\Server::
start
(
function
()
{
$
AppSvr
=
new
Swoole
\
Protocol
\
HttpServer
();
$
AppSvr
->
loadSetting
(
__DIR__
.
'
/swoole.ini
'
);
//加载配置文件
$
AppSvr
->
setDocumentRoot
(
__DIR__
.
'
/webroot
'
);
$
AppSvr
->
setLogger
(
new
Swoole
\
Log
\
EchoLog
(
true
));
//Logger
Swoole
\Error::
$
echo_html
=
false
;
$
server
=
Swoole
\
Network
\Server::
autoCreate
(
'
0.0.0.0
'
,
8888
);
$
server
->
setProtocol
(
$
AppSvr
);
//$server->daemonize(); //作为守护进程
$
server
->
run
(
array
(
'
worker_num
'
=>
0
,
'
max_request
'
=>
5000
,
'
log_file
'
=>
'
/tmp/swoole.log
'
));
});
Back
|
FazBrowse Home
|
New Git URL