Openwrt + PHP on TP-Link TL-WR1043ND Router Featured
This tutorial show you how to install PHP on the TP-Link TL-WR1043ND router.
You can refer to my previous post http://ediy.com.my/index.php/blog/item/2-openwrt-on-tp-link-tl-wr1043nd-router to upgrade firmware to OpenWRT.
opkg install libsqlite3
opkg install php5-fastcgi
# you may need to install php5-mod-session if session authentication require
opkg install php5-mod-session
Screen shot for installing PHP: http://www.divshare.com/download/18063621-528
You might want to modify the /etc/php.ini. For example to change the time zone:
- Find ;date.timezone=
- remove the leading semicolon
- change it to date.timezone = "Asia/Kuala_Lumpur"
see http://www.php.net/manual/en/timezones.php for more about time zone.
Verify PHP is installing correctly
After that, test php installation by running:
You should see the version info and no warning/error message as shown in figure below.
Install lighttpd web server
opkg install lighttpd
opkg install lighttpd-mod-fastcgi
opkg install lighttpd-mod-simple-vhost
Screen shot for installing lighttp: http://www.divshare.com/download/18063882-b1d
Modify lighttpd configuration file
Edit the /etc/lighttpd/lighttpd.conf file. The module mod_fastcgi must be enable. I prefer to use WinSCP to edit the configuration file.
Include index.php to the index-file.names
|index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm" )|
Lighttpd is start at port 80 by default, it is conflict with Luci web server. So we need to change it to port 81.
## bind to port (default: 80)
server.port = 81
The following settings is very imortant. Configure wrong bin-path will cause the PHP not running.
Save the configuration file and reboot the router.
Starting lighttpd and PHP
- Login to OpenWrt.
- Click on System & Select Statup.
Figure below shows how to start lighttpd and PHP.
Upload PHP code to Router
Save the following code to phpinfo.php:
|<?php// Show all information, defaults to INFO_ALLphpinfo();// Show just the module information.// phpinfo(8) yields identical results.phpinfo(INFO_MODULES);?>|
There are many way to upload file to router, I prefer to use WinSCP. The phpinfo.php file is uploaded to the www folder of router as shown in figure below.
Run the PHP file
- Open Internet Explorer
- Enter 192.168.1.1:81/phpinfo.php (Router default IP)
The screen should show the PHP information.
Thursday, 16 January 2020 16:28
posted by Stevambums
Priligy Cura Definitiva Propecia Foglio Illustrativo Vendo Cialis En Madrid buy cialis Starlix Cialis Su Precio
Wednesday, 01 January 2020 15:25
posted by WilliamVed
Monday, 13 June 2016 21:57
posted by Bessie
My brother suggested I might like this website.
He was entirely right. This post actually made my day.
You cann't imagine simply how much time I had spent for this info!