Recently, I accidentally discovered PHP's own Web server functionality. So it was a bit of experimentation. 650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9B/0E/wKiom1ldsMbBnscNAAHSTTBk0kY292.png "title=" 2017-07-06 11-37-43 screen. png "alt=" Wkiom1ldsmbbnscnaahsttbk0ky292.png "/>
As you can see, the following parameters are available in the PHP command-line mode:
-S <addr>:<port> Run with built-in Web server.
-T <docroot> specify document root <docroot> for built-in Web server.
Explain:
-S access address: Port//Run PHP via built-in Web service
-T site root//Specify Web service's Web root directory
So, moving small hands, the world I have.
1. Start the built-in Web service:
[Email protected]:~$ php-s localhost:8080-t ~/www/zhangrenjie_test/test/php 7.0.18-0ubuntu0.16.04.1 Development Server started at Thu Jul 6 11:31:12 2017Listening on http://localhost:8080Document root is/home/zrj/www/zhangrenjie_tes T/testpress ctrl-c to quit. [Thu Jul 6 11:31:26] 127.0.0.1:50692 [[]:/12.php[thu Jul 6 11:31:29] 127.0.0.1:50696 []:/11.php
2. Browser access:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9B/0F/wKiom1ldsy2wMFhpAAA5AJdILxk645.png "title=" 2017-07-06 11-48-33 screen. png "alt=" Wkiom1ldsy2wmfhpaaa5ajdilxk645.png "/>
Mastering this skill, from then on, can no longer worry about the experimental environment.
This article is from the "My PHP path" blog, so be sure to keep this source http://phpme.blog.51cto.com/663593/1944953
How do I run PHP without a third-party Web service?