For Java we have different Application servers like WebSphere and Web logic, My Doubt is do we have any PHP Application servers?
Till now We are using Apache and Nginx web servers for PHP Web applications. How Application servers are useful to PHP?
Thanks Ramu
With PHP-PM, RoadRunner, Swoole the label "app server" is arguable, but they all solve the most problematic part: the wasteful "process app reinit & cleanup on every request". And, in addition to removing the entire HTTP server → aux. process mgmt. → PHP script loading/processing detour from the pipeline (by having an integrated, in-process HTTP server + process management facilities), they also add varying levels/amounts of extra services to help building robust long-lived server-side apps in PHP.
Swoole is technically implemented as a PHP extension, but does much more than the usual ones. It launches worker processes on its own, and it's used like a framework: you'll write your event loop and pass control to Swoole. Your app will be hooked up to handle HTTP requests (or websocket events etc.), using their nonblocking async I/O (networking, filesystem, process mgmt.), plus various other handy services incl. coroutines, IPC, locking etc.). All the async., performance-critical I/O is dealt with in C, via a straightforward PHP API, including:
https://scottaubrey.info/blog/2018-10-22-first-look-at-swoole/
It's basically Node.js for PHP
→ Unofficial extra docs (in addition to the official ones)
RoadRunner is a process manager server (written in Go). From their feature list:
PHP-PM is another advanced PHP process manager (like RoadRunner), but also comes with an app (meta)framework, built on top of ReactPHP (another event-driven, async. I/O lib, similar to Swoole, but implemented in PHP, so inherently slower). This package covers most of the ground of the app-server chores (https://laravel-news.com/php-pm). Some of their listed features:
Bonus: here's a nice, detailed performance test of various architecture alternatives (excluding Swoole) for long-lived sever-side PHP processes. For Swoole (compared to other frameworks, not other PHP process piping setups!), see this nice framework performance chart; it's pretty scary fast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With