[php]Built-in HTTP server

PHP: Hypertext Preprocessor
帖子: 56
注册时间: 2016年07月21日 20:35
拥有现金: 锁定
储蓄: 锁定
Has thanked: 7 times
Been thanked: 5 times

[php]Built-in HTTP server

帖子 #1 vicyang » 2019年03月09日 22:08

浅尝 PHP,循着两篇环境搭建的文章探索了良久(惭愧地说,花了1个钟吧)。


虽然里面有说 XAMPP 是比较省心的方案,但作为不折腾会死党,还是想手动配置一次,折腾完以后翻开 Modern PHP (PDF) 一看:

Built-in HTTP server
Did you know that PHP has a built-in web server as of PHP 5.4.0? This is another
hidden gem unknown to PHP developers who assume they need Apache or nginx to
preview PHP applications. You shouldn't use it for production, but PHP’s built-in web
server is a perfect tool for local development.

I use PHP's built-in web server every day, whether I'm writing PHP or not. I use it to
preview Laravel and Slim Framework applications. I use it while building websites
with the Drupal content-management framework. I also use it to preview static
HTML and CSS if I'm just building out markup.

Start the Server
It's easy to start the PHP web server. Open your terminal application, navigate to your
project's document root directory, and execute this command:

    php -S localhost:4000
This command starts a new PHP web server accessible at localhost. It listens on port
4000. Your current working directory is the web server's document root.


回到 “PHP”


用户浏览此论坛: 没有注册用户 和 1 访客