I remember when I had my first idea for a web app pop in my head. It was a rush, but I didn't know where to even begin. I goolged around and eventually decided PHP was the language for me. Being the noob I was, I immediately signed up for a shared hosting account, bought a domain name, and started attempting to write PHP. I'd write some code, upload the file to my hosting account, point my browser to my domain and hope for the best. I did that for a couple of months. It's embaressing looking back but I didn't know any better. Don't do this.
There's an infinitely better and free way
There are tools now that make getting started coding a breeze but let's discuss some concepts first.
Virtual Machine (VM)
A virtual machine is a software based computer. Typically, they emulate an operating system. In simple terms, a virtual machine allows you to run a computer within your computer. For example, I use a MacBook Pro that runs the 10.7.5 Mac OS X operating system. I can create a virtual machine within my MacBook that runs a completely different operating system, such as the free Ubuntu Precise 12.04 operating system. Why would I want do this? I want to do this because I can run my PHP in my virtual machine on my mac in an environment almost exactly like the environment the code will run when I deploy it to be used for real. Different versions of PHP, Apache, MySQL, etc can have drastic effects on your code. Virtual machines allow you to develop on your local computer and be much more confident it will behave the same when you deploy it.
Local versus Production
You will see programmers saying things like "running locally" or "it works locally but not in production". "Locally" refers to your development machine/environment. My MacBook Pro is my local machine. I'm developing locally when I'm writing/running code on it. "Production" refers to the machine/environment that will be your code's intended destination. For example, if you are paying Digital Ocean $5/month to host a virtual machine to serve your app to the internet, your Digital Ocean VM is your "production" environment.
On to the tools...
Vagrant is a command line tool(don't be scared) that allows you to create, provision, and destroy virtual machines very easily. There is one verb in that last sentence that may have confused you: provision. In VM terminology, provisioning is the process of configuring your virtual machine to install almost anything you want in your virtual machine. For example, you will most likely want PHP, MySQL, and Apache installed to run your web application.
VirtualBox is virtualization software that runs your virtual machines. You don't really need to know anything other than that to get started.
Puppet is a provisioning tool that Vagrant can use to install the things you need in your VM. You can create a Puppet file that defines everything you want installed and have Vagrant use Puppet to actually do the installing.
PuPHPet is an awesome web application that provides a GUI(Graphical User Interface) to allow us mere mortals to specify things we want installed in our VM. PuPHPet will then take your input and translate that into Vagrant and Puppet directories and files and package it up in a zip archive for you to download. Then all you have to do is unzip the package into a folder, open your terminal, go into that folder, issue a
vagrant up command, and new VM will be created and provisioned. You can then start writing PHP and run the code within your newly created VM.
I've covered the very core concepts. Juan Treminio, the developer behind PuPHPet, has a great article that covers these topics a bit more in depth. I encourage you to read that.
Watch and learn