To serve php files, the webserver has to create the content. Dropbox does not allow this to happen. When you are seeing pages in Dropbox, the browser is rendering them. It is the same as having an .html file on your desktop that you open in Chrome or something.
If you want to server php files, you need a webserver that has php installed.
Your question doesn’t give enough information to know how best to answer.
It sounds like you don’t normally use PHP. Do you have some sort of server software installed on your machine? If so, can you confirm that PHP is installed and, if you are on apache, PHP files in your htdocs folder (or equivalent) work as normal.
I apologise if the above questions sound obvious and/or patronising. I’m sure you understand the need for clarity, though.
If the above answers are all positive, then you might want to look into symlinks. Are on windows or *nix?
You can install Dropbox on your server (VPS or with certain shared hosting providers). From there, you can place your site files in your desktop’s Dropbox and work on it there. Any changes you make it will automatically sync to your server. It’s also a great way for automatic backups.
I have no clue if this is a good thing to do – however: I moved my whole dropbox folder to xampp/htdocs/Dropbox
And it’s just fine – I can execute phpfiles wherever I wan’t in my project folders.
So no problem.