OpenWrt builds PHP environment Install PHP - Connect to the Internet first
- Install basic PHP environment
root@OpenWrt:~# opkg updateroot@OpenWrt:~# opkg install php5 php5-cgi
- Modify the configuration file
Add support for PHP script parsing for uhttpd:
root@OpenWrt:~# uci add_list uhttpd.main.interpreter='.php=/usr/bin/php-cgi'
Save the uhttpd configuration and restart uhttpd:
root@OpenWrt:~# uci commit uhttpdroot@OpenWrt:~# /etc/init.d/uhttpd restart
If the PHP page is blank during operation, it may be that PHP has not obtained the time zone. You need to add the following software
root@OpenWrt:~# opkg install zoneinfo-core zoneinfo-asia The above steps have deployed the PHP operating environment on openwrt. Next, we create a mytest.php program in the www directory of the openwr terminal to output helloworld. For more complex PHP, you need to learn more about Baidu. root@Widora:/www# vi mytest.php root@Widora:/www# cat mytest.php
PHP Testing
?php echo '
'; ?> Run the relevant URL on the browser and it will be OK.
In this way, we can start to deploy a good PHP application or even a small website on our router. This content is originally created by EEWORLD forum user wateras1. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source