Notes About Working with Various Arduino & Netduino Microcontroller Boards

Monday, October 28, 2013

Installing PHP on the Arduino Yun

Installing the CGI version of PHP5 on the Arduino Yun is quite simple.  I was able to get it installed in and running in a few minutes with the following steps:

  1. Use SSH to access the Yun's command Linux command line.
  2. Run opkg to install PHP:
    1. opkg update
    2. opkg install php5-cgi
  3. Run the following command to configure the PHP module for uhttp:uci add_list.  These commands are slightly modified from those given at
    1. uci set uhttpd.main.interpreter=".php=/usr/bin/php-cgi"
    2. uci set uhttpd.main.index_page="index.html index.htm default.html default.htm index.php"
    3. uci commit uhttpd
    4. sed -i 's,doc_root.*,doc_root = "",g' /etc/php.ini
    5. sed -i 's,;short_open_tag = Off,short_open_tag = On,g' /etc/php.ini
    6. Restart uhttpd with the command /etc/init.d/uhttpd restart
Assuming that you are using an SD card for your Web files, place your PHP files in the /mnt/sd/arduino/www directory.

Note (05/08/2014): After upgrading my OpenWrt-Yun image and after following the process described on the Arduino blog to use a micro-SD card in place of the Yun's internal memory, I find that the uhttpd Web server looks for its Web page files in the /www directory, not /mnt/sd/arduino/www.


  1. Thanks It worked OK for me !!!!!!

    1. Glad to hear you found the post helpful.

  2. Its working and simplest guide .... Thanks for the post !!

  3. Hello
    Do you have the same command for install PHmyAdmin and MYSQL please
    Thank you a lot for your help