我们有任何 php 应用程序服务器(不是 Web 服务器)吗? [英] Do We have any php application servers (not web servers)?

查看:58
本文介绍了我们有任何 php 应用程序服务器(不是 Web 服务器)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 Java,我们有不同的应用服务器,如 WebSphere 和 Web 逻辑,我的疑问是我们有任何 PHP 应用程序服务器吗?

For Java we have different Application servers like WebSphere and Web logic, My Doubt is do we have any PHP Application servers?

到目前为止,我们使用 Apache 和 Nginx Web 服务器来运行 PHP Web 应用程序.应用服务器对 PHP 有何帮助?

Till now We are using Apache and Nginx web servers for PHP Web applications. How Application servers are useful to PHP?

谢谢拉姆

推荐答案

With PHP-PMRoadRunnerSwoole 标签应用服务器"是有争议的,但它们都解决了最有问题的部分:浪费的处理应用程序重新初始化和清理每个请求".并且,除了删除整个 HTTP 服务器 →辅助.流程管理→PHP 脚本加载/处理绕过管道(通过集成的、进程内 HTTP 服务器 + 进程管理工具),他们还添加了不同级别/数量的额外服务来帮助构建使用 PHP 编写的强大且长期存在的服务器端应用.

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 在技术上是作为 PHP 扩展实现的,但 比通常的做的更多.它自己启动工作进程,它就像一个框架一样使用:您将编写事件循环并将控制权传递给 Swoole.您的应用程序将连接到处理 HTTP 请求(或 websocket 事件等),使用它们的非阻塞异步 I/O(网络、文件系统、进程管理),以及各种其他方便的服务,包括.协程、IPC、锁定等).所有异步的、性能关键的 I/O 都是用 C 语言处理的,通过一个简单的 PHP API,包括:

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:

  • HTTP 服务器和客户端
  • TCP/UDP 服务器和客户端
  • Websocket 服务器
  • Redis 服务器
  • MySQL 客户端
  • 文件系统 I/O、IPC、进程管理.等

https://scottaubrey.info/blog/2018-10-22-first-look-at-swoole/

基本上是 Node.用于 PHP 的 Node.js

非官方的额外文档(除了官方的)

RoadRunner 是一个流程管理服务器(用 Go 编写).从他们的功能列表:

RoadRunner is a process manager server (written in Go). From their feature list:

  • PSR-7 HTTP 服务器(文件上传、错误处理、静态文件、热重载、中间件、事件侦听器)
  • HTTPS 和 HTTP/2 支持(包括 HTTP/2 推送、H2C)
  • 完全可定制的服务器,FastCGI 支持
  • 负载平衡器、流程管理器和任务管道
  • 在 TCP、UNIX 套接字和标准管道上工作
  • 自动更换工人和安全的 PHP 进程销毁
  • 工作线程生命周期管理(控制器)
  • 非常快(使用 16 个线程在 Ryzen 1700X 上每秒调用约 25 万次 rpc)
  • 与 Symfony、Laravel、Slim、CakePHP、Zend Expressive 的集成
  • 自动重新加载文件更改
  • 适用于 Windows(Windows 10 支持 Unix 套接字 (AF_UNIX))

PHP-PM 是另一种高级 PHP 进程管理器(如 RoadRunner),但也带有一个应用(元)框架,构建在 ReactPHP(另一个事件驱动的异步 I/O 库,类似于 Swoole,但在 PHP 中实现,因此本质上较慢).这个包涵盖了应用服务器杂务的大部分内容(https://laravel-news.com/php-pm).他们列出的一些功能:

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:

  • 集成负载平衡器.
  • 热代码重新加载(当 PHP 文件更改时).
  • 用于简化开发过程的静态文件服务.
  • 支持 HttpKernel (Symfony/Laravel)、Drupal(实验性)、Zend(实验性).

奖励:这是针对长期服务器端 PHP 进程的各种架构替代方案(不包括 Swoole)的不错的详细性能测试.对于 Swoole(与其他框架相比,而不是其他 PHP 进程管道设置!),请参阅这个不错的框架性能图表;速度非常快.

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.

这篇关于我们有任何 php 应用程序服务器(不是 Web 服务器)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆