What the best way to use workerman with yii2?
shizzic opened this issue · comments
Just share your implemination please. I think it may be a big help for many ppl.
I have an implementation with Adapterman.
I can help you and show the code.
PD: I think that I read somewhere, than exist an implementation only for yii2.
I have an implementation with Adapterman.
I can help you and show the code.
PD: I think that I read somewhere, than exist an implementation only for yii2.
Please, share your code)
The code in the benchmark:
https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/PHP/yii2
The important parts:
server.php
https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/yii2/server.php
Added the 2 lines:
$_SERVER['SCRIPT_FILENAME'] = '/app/index.php';
$_SERVER['SCRIPT_NAME'] = '/index.php';
As yii2, don't created it correctly.
The WorkerTimer is because the bench need to have a Date:
header.
And I didn't want to touch the initial yii2 app code.
index.php
https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/yii2/app/index.php#L54-L62
To run with Workerman, you only need to comment the line 54.
Dockefile
https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/yii2/yii2-workerman.dockerfile
Here I need to change 1 line in yii2, or stop there always (marked with the arrow)
And run it php server.php start
.
Remember that Adapterman is only an application server, you need to serve static files with the webserver.
Thank you!