Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
docs:guide-user:services:webserver:php [2019/03/22 09:59] – [PHP Development Server] cleanup tmomasdocs:guide-user:services:webserver:php [2019/03/23 04:47] – [PHP Development Server] Links, all the links! smoothswim
Line 32: Line 32:
 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 **php7-cli** package using [[docs:guide-user:additional-software:opkg|opkg]]. +Install the [[packages:pkgdata:php7-cgi|php7-cgi]] package using [[docs:guide-user:additional-software:opkg|opkg]]. 
-<code>opkg update && opkg install php7-cli</code> +<code bash>opkg update && opkg install php7-cli</code> 
-//(This pulls in packages libpcre zlib libxml2 zoneinfo-core php7 as part of the installation.)//+//(This pulls in packages [[packages:pkgdata:libpcre|libpcre]] [[packages:pkgdata:zlib|zlib]] [[packages:pkgdata:libxml2|libxml2]] [[packages:pkgdata:zoneinfo-core|zoneinfo-core]] [[packages:pkgdata:php7|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.
-<code>rm -r /tmp/opkg-lists/</code>+<code bash>rm -r /tmp/opkg-lists/</code>
 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.)
-<code>mkdir /www</code> +<code bash>mkdir /www</code> 
-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:pkgdata:nano|nano]] in this example) to create the file **index.php** inside of the **/www** directory (nano can be installed via [[docs:guide-user:additional-software:opkg|opkg]] if need be.) 
-<code>nano /www/index.php</code>+<code bash>nano /www/index.php</code>
 Add the text "**It works!**" into the file, save and close it. Add the text "**It works!**" into the file, save and close it.
  
 Start the webserver from the command line. Start the webserver from the command line.
-<code>php-cli -S 172.16.0.1:8080 -t /www</code>+<code bash>php-cli -S 172.16.0.1:8080 -t /www</code>
 //(Replace **172.16.0.1:8080** with the ip address of your OpenWrt instance and the port number you want to use to access the server by.)// //(Replace **172.16.0.1:8080** with the ip address of your OpenWrt instance and the port number you want to use to access the server by.)//
  
-Open a web browser and visit the address <nowiki>http://172.16.0.1:8080</nowiki> (or whatever you used instead) and you should see the text "**It works!**" on the page.+Open a web browser and visit the address **<nowiki>http://172.16.0.1:8080</nowiki>** (or whatever you used instead) and you should see the text "**It works!**" on the page.
  
 That's all there is to it. That's all there is to it.
Line 55: Line 55:
 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.
-<code>php-cli -S 172.16.0.1:8080 -t /www &&</code>+<code bash>php-cli -S 172.16.0.1:8080 -t /www &&</code>
 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.
  • Last modified: 2019/04/04 07:08
  • by vgaetera