funnily enough, i've just helped put together a heiarchical mysql database.
without going into too much of the details, each element has a unique id, and a parent value. so, in your example, php has a parent of languages, and languages has a parent of root. toplevel elements have a NULL parent. an element can of course have multiple children.
you may also want some way to order the children of a given element amongst themselves, but alphabetically may be sufficient for your needs.
a couple of points to note; when you move a node all its children will be moved with it. if you delete one, you must either delete all descendants, or move the children of the delete element up one level.
as to permissions.. i defined an is_descendant() function with which i could check if the branch being accessed was one which the user had access to.
one final note: hiearchical dbs, while nice, can cause a lot of server load; select queries inside loops and suchlike.