So I am by using this website:

to create Light on my small Ubuntu Virtual Machine.

Here's my question though,

This can enable me to program and test through localhost. How do i set this up so anybody on the internet can access my .php pages from the Internet capable device, and they'll still communicate with my local database, etc?

Should you open port 80 inside your firewall for your local machine, it should be accessible towards the outdoors world via your ip. You will have to look at your router configurations to learn how to do that, truly it's known as port sending.

You can then make use of a free service like dyndns to provide your domain title that you could then type to your browser for example

You've got a handful of options...
1) Look for a site that hosts Light and set you site available online for. Most of them permit you to purchase a domain title plus they manage the equipment.
2) Do what Ben Rowe recommended, make use of a DNS sending service (Some have the freedom, some not). Host the website by yourself machine, some ISPs do not let you to employ port 80, you will need to make use of another port.