Computers, Development Boards & Shields
Educational & Robotics Kits
Electronic Sensors
Motors & Controllers
Communication & Display
Electronic Components
Soldering & Lab Tools

How to install PHP on the PcDuino 3 (LAMP P2)

This guide is designed to help you install PHP on your PcDuino 3 and is a follow up to the PcDuino Apache Installation Guide, and part two of the PcDuino 3 LAMP Server installation guide. If you are reading this then you probably have a PcDuino 3 that you need to install a LAMP (Linux Apache MySQL PHP) server on. Again if you haven’t install Apache yet please follow the guide linked above to do so before proceeding. This guide should work for all older versions of the PcDuino as well, though some things may be specific to the current version of the board. For those of you who are not aware PHP is a free open source web programming language engine that powers some part of almost every major website in the world. Also be advised that the instructions in this guide are specific to the PcDuino 3, but should be roughly identical on most Ubuntu builds.

The Pcduino 3 requires 5V DC power through use of a USB micro, an HDMI cable to be connected to a television or monitor that allows HDMI input, a standard keyboard, and a mouse (technically not required, but it sure makes it easier to open things up). To ensure that the keyboard and mouse can be used together it is wise to use a powered USB hub throughout set-up since some Mouse/Keyboard combos may exceed your supply if you don’t have the recommended 2A supply connected.

Install PHP on the PcDuino 3:

Once PCDuino3 has completed boot up a desktop several preset icons will be present on the

screen.  One of these icons will be labeled LXTerminal. Opening this icon allows for you to enter the terminal commands throughout this guide.

Linux – Should be installed by default.

NOTE: the “sudo apt-get update” command can take several hours to update all

repositories depending on how out of date yours are. Most users can proceed without

the update, but if unexpected problems come up this can often be the cause.

Apache – Should have been installed before proceeding: PcDuino Apache Installation Guide

PHP – Your server is about to get a whole lot more powerful with the PHP scripting language for server side scripting.

To install PHP type “sudo apt-get install php5 libapache2-mod-php5” and press enter. When asked if you wish to continue type “y” and press enter.

After installation is complete restart the Apache web server by entering “sudo service apache2 restart” into the command line.

To ensure php is running properly create a test file by typing the following into the command line:

sudo touch /var/www/test.php” and pressing enter (this creates the file).

Then edit the file by typing “sudo nano /var/www/test.php” (substitute your favorite installed text editor for nano if you like) and press enter. If command is not found you will have to install nano (or call an existing editor like leafpad). The Nano editor can be installed by typing “sudo apt-get install nano”.

Once the text editor is up type in the following content to the PHP file

This code will make the test.php file call the phpinfo() function for displaying detailed php configuration and installation information. After

typing the commands press CTRL X to exit and type y and press enter to save (these are nano specific instructions) and return to the

LXTerminal. Now open the chromium web browser in the taskbar and in the address bar type “localhost/test.php” and hit enter. If working properly a page displaying all information about your PHP install should be visible. This ensures php is working with the Apache Web Server.

At this point you should ensure that there is no issue with privileges the by granting the appropriate privileges to the web folder. Type “nano /etc/sudoers” and then add the line “USER ALL=(ALL:ALL) ALL” to allow the user root privileges. This will be particularly important for when we install our FTP server in the next guide.

A change mod will also need to be performed to allow directory access for files to be created, and edited on the web server.

To do this run the command “sudo chmod 777 –R /var/www/html“.

And there you have it, now you can probably do three fourths of everything you would want to do on a custom PcDuino 3 server, but in the next guide we are going to make things even better by adding FTP access to allow editing web files with out the need for a monitor, keyboard, or mouse to be connected to our PcDuino 3!

No comments yet.

Leave a Reply