Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:webserver:php [2019/03/22 08:42] – [PHP Development Server] Just some links and a few words changed smoothswim | docs:guide-user:services:webserver:php [2019/03/23 04:47] – [PHP Development Server] Links, all the links! smoothswim | ||
|---|---|---|---|
| Line 27: | Line 27: | ||
| This section explains how to quickly setup a php test server for prototyping php web applications, | This section explains how to quickly setup a php test server for prototyping php web applications, | ||
| - | A little known trick about php is that it has it's own built in web server. | + | A little known trick about php is that it has it's own built in web server.\\ |
| - | \\ | + | If you install the command line php binary, you can run a quick, no frills web server on OpenWrt for development work and prototyping.\\ |
| - | If you install the command line php binary, you can run a quick, no frills web server on OpenWrt for development work and prototyping. | + | In no way should you expect a fully production ready web server from this method. php's internal web server is recommended for your own internal network testing and is not recommended as an alternative to a fully fledged http server daemon.\\ |
| - | \\ | + | |
| - | In no way should you expect a fully production ready web server from this method. php's internal web server is recommended for your own internal network testing and is not recommended as an alternative to a fully fledged http server daemon. | + | |
| - | \\ | + | |
| With that said; complete the following steps to create a quick php development server inside of an OpenWrt instance: | With that said; complete the following steps to create a quick php development server inside of an OpenWrt instance: | ||
| - | \\ | + | |
| - | \\ | + | Install the [[packages: |
| - | Install the **php7-cli** package using [[docs: | + | < |
| - | < | + | //(This pulls in packages |
| - | //(This pulls in packages libpcre zlib libxml2 zoneinfo-core php7 as part of the installation.)// | + | |
| - | \\ | + | |
| - | \\ | + | |
| Optionally, now remove the package cache if you are low on memory space. | Optionally, now remove the package cache if you are low on memory space. | ||
| - | < | + | < |
| Create a www directory (during testing, I skipped this normal step and just used the /root directory instead.) | Create a www directory (during testing, I skipped this normal step and just used the /root directory instead.) | ||
| - | < | + | < |
| - | Use a text editor (**nano** in this example) to create the file **index.php** inside of the **/www** directory (nano can be installed via opkg if need be.) | + | Use a text editor ([[packages: |
| - | < | + | < |
| Add the text "**It works!**" | Add the text "**It works!**" | ||
| - | \\ | + | |
| - | \\ | + | |
| Start the webserver from the command line. | Start the webserver from the command line. | ||
| - | < | + | < |
| //(Replace **172.16.0.1: | //(Replace **172.16.0.1: | ||
| - | \\ | + | |
| - | \\ | + | Open a web browser and visit the address |
| - | Open a web browser and visit the address < | + | |
| - | \\ | + | |
| - | \\ | + | |
| That's all there is to it. | That's all there is to it. | ||
| - | \\ | + | |
| - | \\ | + | Taking it further, you could optionally [[docs: |
| - | Taking it further, you could optionally [[docs: | + | To stop the server use the **ctrl + c** key combination.\\ |
| - | \\ | + | |
| - | To stop the server use the **ctrl + c** key combination. | + | |
| - | \\ | + | |
| To spawn the server into a separate process and return command back to the console, add a double ampersand to the end of the command line options you use to start the server. | To spawn the server into a separate process and return command back to the console, add a double ampersand to the end of the command line options you use to start the server. | ||
| - | < | + | < |
| The web server will then remain running until it's process is manually ended or the OpenWrt instance has been rebooted. | The web server will then remain running until it's process is manually ended or the OpenWrt instance has been rebooted. | ||