PHP web server in PHP?

后端 未结 4 1291
梦毁少年i
梦毁少年i 2020-12-20 11:03

i.e to replace Apache with a PHP application that sent back html files when http requests for .php files are sent?

How practical is this?

4条回答
  •  无人及你
    2020-12-20 11:16

    Just FYI, PHP 5.4 just released with in-built webserver. Now you can run a local server with very simple commands like -

    $ cd ~/public_html
    $ php -S localhost:8000
    

    And you'll see the requests and responses like this -

    PHP 5.4.0 Development Server started at Thu Jul 21 10:43:28 2011
    Listening on localhost:8000
    Document root is /home/me/public_html
    Press Ctrl-C to quit.
    [Thu Jul 21 10:48:48 2011] ::1:39144 GET /favicon.ico - Request read
    [Thu Jul 21 10:48:50 2011] ::1:39146 GET / - Request read
    [Thu Jul 21 10:48:50 2011] ::1:39147 GET /favicon.ico - Request read
    [Thu Jul 21 10:48:52 2011] ::1:39148 GET /myscript.html - Request read
    [Thu Jul 21 10:48:52 2011] ::1:39149 GET /favicon.ico - Request read
    

提交回复
热议问题