First of all, i originally found this information here and here, but the site seems down right now so i decided to put the information here aswell (with some modifications).
First of all i disable the web services:
systemctl disable cloud9.service
systemctl disable bone101.service
systemctl disable gateone.service
Then i install the required php packages:
opkg install php php-cgi php-cli
opkg install lighttpd lighttpd-module-fastcgi
Edit the lighttpd config file located at /etc/lighttpd.conf to enable fast-cgi:
Locate the server.modues line and uncomment mod_fastcgi:
Then further down the file is the fastcgi.server configuration, uncomment the lines to look something like this:
Make sure the path for php-cgi is correct!
Save the file and restart the lighted server:
/etc/init.d/lighttpd restart
Now, lets try if it works.
Create a new php file in /www/pages called index.php:
Finally, point your browser to the adress of your beaglebone and the PHP info page should show.