用于 PHP 的轻量级 Web 应用服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/171655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 21:46:10  来源:igfitidea点击:

Lightweight web app server for PHP?

phpwebserver

提问by liangzan

I'm doing PHP development. And coming from a Rails background, I'm looking for a like-for-like replacement for Webrick in PHP. Is there such a light weight server? Something with minimal configuration and installation effort. Apache is actually fine. But I would like to know if there're other options. Or do most of you use Apache?

我在做 PHP 开发。来自 Rails 背景,我正在寻找 PHP 中 Webrick 的同类替代品。有这么轻量级的服务器吗?配置和安装工作最少的东西。阿帕奇其实还好。但我想知道是否还有其他选择。或者你们大多数人都使用Apache吗?

回答by Owen

have you taken a look at lighthttpd?

你看过lighthttpd吗?

回答by Andrew

Back when Lighty was having many reports of memory leaks, someone mentioned Nginx. Ignore the ridiculous name, it's actually the best HTTPd I've ever used (and I've been using Apache since 1.1). Install PHP as FCGI rather than a module and you're golden.

回到 Lighty 有很多关于内存泄漏的报告时,有人提到了Nginx。忽略这个荒谬的名字,它实际上是我用过的最好的 HTTPd(而且我从 1.1 开始就一直在使用 Apache)。将 PHP 安装为 FCGI 而不是模块,你就是金子。

回答by fe_lix_

You should try sng.

你应该试试sng

It is script which launches a PHP/Nginx development server quickly without any admin privileges. In is made in nodejs

这是一个无需任何管理员权限即可快速启动 PHP/Nginx 开发服务器的脚本。在nodejs 中

You can install it very easily with :

你可以很容易地安装它:

npm install sng

回答by conmulligan

You could try cherokee. It doesn't come configured with PHP out of the box, but it's easy to set up and very fast,

你可以试试切诺基。它没有开箱即用的 PHP 配置,但它易于设置且速度非常快,

回答by Keith Gray

For development, just use...

对于开发,只需使用...

php -S 127.0.0.1:8080

php -S 127.0.0.1:8080

回答by Oli

Most here will use apache but there are other options. IBM posted a nice long article on the subject. Not all of them will support PHP.

这里的大多数将使用 apache,但还有其他选择。IBM 发布了一篇关于该主题的长篇文章。并非所有这些都支持 PHP。

Of these alternatives, lighttpd is probably the most popular.

在这些替代方案中,lighttpd 可能是最受欢迎的。

回答by Oli

You can optimize Apache as your need. I prefer Apache for it's robustness.

您可以根据需要优化 Apache。我更喜欢 Apache,因为它的健壮性。

回答by Darryl Hein

Regarding do most use Apache, the answer is yes. Most servers on the web are using Apache (mostly LAMP). PRobabyly the biggest reason is because Apache is very flexible works with just about anything. It has a lot of plugins and is very configurable. It is also very fast and runs on just about anything.

对于最常使用的 Apache,答案是肯定的。网络上的大多数服务器都在使用 Apache(主要是 LAMP)。可能最大的原因是因为 Apache 非常灵活,几乎可以处理任何事情。它有很多插件并且是非常可配置的。它也非常快,几乎可以在任何东西上运行。

回答by Toby Hede

I use Apache for PHP development.

我使用 Apache 进行 PHP 开发。

On Windows I recommend installing XAMPP- it's a full pre-configured PHP/MySQL stack.

在 Windows 上,我建议安装XAMPP- 它是一个完整的预配置 PHP/MySQL 堆栈。

Mac OS X can be a bit trickier, but I've managed with the pre-installed setup.

Mac OS X 可能有点棘手,但我已经使用预安装的设置进行了管理。

回答by MarkR

Almost everyone runs PHP in Apache, hardly anyone runs it with anything else. The risk of using something else is far outweighed by the benefit of using a standard application server platform.

几乎每个人都在 Apache 中运行 PHP,几乎没有人使用其他任何东西运行它。使用标准应用服务器平台的好处远远超过使用其他东西的风险。

If you did use some other web server, will PHP will continue to support it in future releases? (this is of course a problem for Apache as well, but more likely).

如果您确实使用了其他 Web 服务器,PHP 会在未来的版本中继续支持它吗?(这当然也是 Apache 的问题,但更有可能)。

In what way is Apache not "Light enough" for you?

Apache 在哪些方面对您来说不够“轻”?