OpenWRT: Installing and Running PHP5
What if you could run PHP scripts or applications your router? The aftermarket firmware OpenWRT allows you to install and run PHP easily in a snap! However dont expect to serve 1000 concurrent connections to a Wordpress installation hosted on your router! Lets get started.
And, if you didn’t know about OpenWRT, it is a third-party after-market firmware available for many routers. (You can think of it as Cyanogenmod for Routers)
What you need
-
A OpenWRT installed router with a external USB storage mounted as rootfs
-
A working internet connection
Installing Packages
-
Login to your routers shell via SSH.
-
Install the
php5andphp5-clipackage viaopkg.
opkg install php5 php5-cli
Testing
- Create a file named
test.phpin a location of your choice with the following text:
<?php phpinfo(); ?>
- Run the following command in the directory with the file you just created. (Use your favorite port number here, if you dont like 9000)
php5-cli -S 0.0.0.0:9000
- Open
http://IP_OF_YOUR_ROUTER:PORT/test.phpin your browser, in my case the URL is http://192.168.1.1:9000/test.php
opkg update
opkg list "php*"
And then install them as required by doing a simple opkg install!
Happy Hacking! :D