← blog

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

Installing Packages

  • Login to your routers shell via SSH.

  • Install the php5 and php5-cli package via opkg.

opkg install php5 php5-cli

Testing

  • Create a file named test.php in 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
opkg update
opkg list "php*"

And then install them as required by doing a simple opkg install!

Happy Hacking! :D