简体   繁体   English

如何提高PHP CLI的输出速度

[英]How can I improve PHP CLI output speed

Recently discovered merits in running php scripts via cli, and while the work-flow is faster I've found that executing php scripts via cli is much slower than just refreshing the browser. 最近发现的优点是通过cli运行php脚本,虽然工作流程更快,但我发现通过cli执行php脚本比刷新浏览器要慢得多。

echo 'hello'; // >1 second cli vs <10 millisecond in browser

I understand php environment is required to load on every execution call (via php -f), whereas in the browser, php is already loaded into memory via the webserver. 我了解在每次执行调用时都需要加载php环境(通过php -f),而在浏览器中,php已通过网络服务器加载到内存中。

I'm looking for a solution to speed php startup time. 我正在寻找解决方案,以加快php启动时间。 Apache is running. Apache正在运行。

The goal is to speed up the output via a text editors output, which by default runs php -f. 目标是通过文本编辑器输出加快输出速度,该输出默认运行php -f。

I'm hoping there is a way to either I pre-load php or pipe into apache directly maybe by using the fast-cgi stream directly, but how? 我希望有一种方法可以直接将php或管道直接加载到apache中,也许可以直接使用fast-cgi流,但是如何?

If you are running php on windows and have curl enabled you might be experiencing a bug which was reintroduced in 5.3.6, and also existed before 5.3.5. 如果您在Windows上运行php并且启用了curl功能,则可能会遇到一个错误 ,该错误已在5.3.6中重新引入,并且在5.3.5之前也存在。 The libcurl library takes ages to load when on windows. 在Windows上加载libcurl库需要花费一些时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM