Install and Configure PHP On An OpenWRT Router [with TinyFileManager]
#OpenWRT #Router #PHP
Full steps can be found at https://i12bretro.github.io/tutorials/0734.html
--------------------------------------------------------------------
What is OpenWRT?
--------------------------------------------------------------------
OpenWRT is an open-source project for embedded operating systems based on Linux, primarily used on embedded devices to route network traffic. The main components are Linux, util-linux, musl, and BusyBox. All components have been optimized to be small enough to fit into the limited storage and memory available in home routers. - https://en.wikipedia.org/wiki/OpenWrt
--------------------------------------------------------------------
Installing and Configuring PHP
--------------------------------------------------------------------
01. Log into the OpenWRT web interface
02. Select System ≫ Software from the top navigation menu
03. Click the Updates lists... button
04. Using the filter, install the following packages
alternatively, run opkg install luci-app-uhttpd php7 php7-cgi tar from the command line
- luci-app-uhttpd
- php7
- php7-cgi
- tar
09. Filter the software list to zoneinfo ≫ Install required timezone files from the listing
10. Refresh the OpenWRT page then select Services ≫ uHTTPd from the top navigation menu
11. Select the Full Web Server Settings tab
12. On the Index page(s) field, add an entry for index.php
13. On the CGI filetype handler field, add an entry for .php=/usr/bin/php-cgi
14. Scroll to the bottom of the page ≫ Click Save & Apply
15. SSH into the OpenWRT device
16. Run the following command to create a test php file
# create a phpinfo test file
echo "≪?php phpinfo(); ?≫" ≫ /www/phpinfo.php
17. Open a new tab in the web browser and navigate to http://DNSorIP/phpinfo.php
--------------------------------------------------------------------
Installing TinyFileManager
--------------------------------------------------------------------
01. Back in the SSH session, run the following commands
# install required php modules
opkg install php7-mod-ctype php7-mod-fileinfo php7-mod-iconv php7-mod-json php7-mod-mbstring php7-mod-session php7-mod-zip
# download tinyfilemanager
wget -O tinyfilemanager.tar.gz https://api.github.com/repos/prasathmani/tinyfilemanager/tarball/2.4.7 --no-check-certificate
# create tinyfilemanager directory
mkdir tinyfilemanager
# extract the .tar.gz
tar xvzf ./tinyfilemanager.tar.gz -C ./tinyfilemanager --strip-components=1
# move tinyfilemanager.php to the webroot
cp ./tinyfilemanager/tinyfilemanager.php /www
02. Back in the web browser, navigate to http://DNSorIP/tinyfilemanager.php
03. Login with username admin password admin@123
NOTE: Authentication can be edited or disabled completely by editing tinyfilemanager.php and searching for $auth_users
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro