**title**
Yii3 no longer depends on php-fpm, very good direction
**description**
rt, I am very happy that yii3 has adopted this strategy, If PHP is resident in memory, we can do more things and get better performance
newest
In development environment, we can run Yii3 using vendor/bin/yii serve
In production environment, can we do this ?
As of PHP 5.4.0, the CLI SAPI provides a built-in web server, vendor/bin/yii serve handle web requests through the build-in web server
This web server was designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network
So we cannot run yii3 using vendor/bin/yii serve for production environment
PS.
If don’t want to use php-fpm + nginx architecture, we can use asynchronous framework, like Swoole, Amp, ReactPHP, to get higher performace and extend more PHP usage scenarios, like custom network protocol, write Async TCP / UDP / HTTP / Websocket / HTTP2 Client/Server Side API
Not running yet. I mistakenly thought that yii3 doesn’t need php-fpm and the production environment can use php directly
currently, the production environment needs to rely on php-fpm, this is somewhat limited and not powerful enough. Background tasks and websites need to be run in two ways
I don’t think it’s right to say that Yii 3 removes a dependency that prevented Yii 2.0 from meeting your needs.
I use Yii 2.0 with
nginx with php-fpm back-end for web app and rest api
nginx and websocket server back-end running in PHP CLI SAPI and implemented with ReactPHP/Ratchet
TCP and UDP custom protocol server daemons running in PHP CLI SAPI using ReactPHP
daemons running in PHP CLI SAPI making multiplexed event-driven outgoing requests using ReactPHP/Guzzle
The first is standard request-driven PHP but the rest are asynchronous and handle multiple tasks with event-driven multiplexing.
We could have done the same with Swoole instead of react using the same architecture.
I do not believe Yii 2.0 and Yii3 are different in this respect. If Yii3 is not going to be stable soon enough for you then I believe you can choose Yii 2.0 and it will work fine with Swoole.
Iiuc, the critical difference between Swoole and ReactPHP is that Swoole is a C/C++ implementation while ReactPHP is PHP and can use a number of event loops including the built-in stream_select(), which we use.
At this moment there are some problems with running Yii3 w/o nginx-like server in front of it. I’m working on some core fixes in order to support PSR-7 server like RoadRunner.