donglian4879 2016-05-19 10:25
浏览 59

使用php7作为唯一的Web服务器可能吗?

While reading Symfony framework installation instructions I came across a recommendation to use php7 buit-in web server, but the same instruction suggests that php internal web server is not for production environment.

Configuring a Web Server

The preferred way to develop your Symfony application is to use PHP's internal web server. However, when using an older PHP version or when running the application in the production environment, you'll need to use a fully-featured web server. This article describes several ways to use Symfony with Apache or Nginx.

I wanted to setup a test server with a minimal bundle that can serve php applications, i.e. Ubuntu 14 + PHP7 but it appears the minimal bundle is Ubuntu + Nginx + PHP7

After an hour's Google browsing, I only got thousands of articles on PHP web server usage with Apache, Nginx but there is lack of info on using PHP7 inbuilt webserver alone, without any other server

So is php7 alone web server possible or is it a toy or a development tool rather than production server?

  • 写回答

1条回答 默认 最新

  • dongzice4895 2016-05-19 10:38
    关注

    You could use Run with built-in web server feature of PHP.

    This feature is supported since PHP 5 and using php-cli. If you want to use it in PHP 7 just install php7.0-cli.

    Then you can quickly setup a web server using this command (in terminal):

    php -S <web server address>:<port> -t <document_root>
    

    Example:

    php -S 127.0.0.1:8080 -t /home/public_html/public
    

    And access your web using browser with that url: 127.0.0.1:8080

    Also you can replace it with IP or domain name of your remote server and it still work

    Hope it exactly what you need

    评论

报告相同问题?

悬赏问题

  • ¥15 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao