October 9, 2024

Installing Apache and PHP on an Intel Edison with Yocto Poky 3.5

I got the chance to play with an Intel Edison board a couple of months ago, and I just got my own board today, so I spent a bit of my afternoon settings things up, and playing with it.

One thing I noticed, is that most tutorials and guides for the Edison were written for the version of the system that was popular during the “golden age” of these boards (the “2015-05-25” image), which is no longer the latest version. Now that I’ve upgraded mine to the most recent image (2016-06-06) it was clear that a lot of packages were upgraded, removed or changed, which means that a lot of tutorials, guides and info online no longer apply (I actually experienced this first-hand when trying to find config files that were nowhere to be found, or disable services that no longer existed).

But among the differences, the worst offense (to me) is that Apache is missing (It was apparently replaced by nodeJS as their “web” technology of choice). A lot of fun things you can do with an Edison (and other linux boards) require Apache or PHP, so this might be a problem for a lof of you, not only myself.

But anyway, upgrading is usually good (as long as the new software runs well), so I decided to give the new version a chance.

Upgrading your board to Yocto Poky 3.5  (2016-06-06)

Whether this is your first time playing with an Edison board, or your 100th, the easiest way of get everything you need (drivers, flash tool and latest image), is to run the iotdk_win_installer package from the official support page, and follow the steps on screen. If you don’t want to use the friendly installer, and you prefer to manually flash the latest image using FlashTool Lite, you can get the image here, but I’ll assume you know what you are doing.

The board I had used before was an Arduino Edison Breakout kit, but the one I got for myself is a DFRobot IO Expansion Shield for Intel Edison. They both work just fine.

Anyway, once you’ve upgraded your Edison, connect via Serial terminal to the COM port of your board, login as root (no password) and we are ready to go.

Setup and Installing Packages

First let’s enable ssh access over wifi. For that you need to set a root password first, and then configure your wireless network:

configure_edison --password
configure_edison --wifi

If your wireless AP is using the 192.168.2.x subnet, then your connections over wifi will fail, as the usb0 network interface tries to take over with a static 192.168.2.15 IP. To change that run nano /etc/systemd/network/usb0.network and set the IP to something like 192.168.3.15, then reboot (or disable/enable the usb0 interface with ifconfig).

As this is a fresh install, you’ll have to run opkg update to refresh the list of available packages. Then you can install apache and enable it as a service by running:

opkg install apache2
systemctl enable apache2
systemctl start apache2

You can check your Edison’s IP with ifconfig, and then point your computer’s browser to its IP to check if it worked:

It works indeed.

Then with nano I added the following repositories to /etc/opkg/base-feeds.conf

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

And ran opkg update again. After that you can run:

 opkg install php-modphp

With that done, you can reboot the board and you should have PHP with your Apache installation. You can verify this by writing a simple PHP script inside the /usr/share/apache2/htdocs directory, and pointing your desktop browser to it. Something like this will do:

<?php
  echo "PHP Version: " . phpversion();
?>

Again, you can check with your browser:

Equally exciting.

I think there’s a lot of cool things you can do with nodeJS, and quite a number of exciting technologies run on it, but that’s also the case with Apache, and for simple web interfaces (or any web hosting application) nothing beats a dedicated web server solution.

 

2 thoughts on “Installing Apache and PHP on an Intel Edison with Yocto Poky 3.5

    1. Regardless of how much of a bad choice for several tasks PHP could be, a number of things and interesting projects still run on it. It’s not intrinsically bad tech, and it’s probably better than using NodeJS and mongo for web-db interactions.

Leave a Reply

Your email address will not be published. Required fields are marked *