Beaglebone Black Rev. C. Debian: HTML, Javascript, PHP, SQL

I have a BBB.html web-page with a JavaScript program (BBB.js) running behind it that uses node.js to send commands from the web-page to the beaglebone io. I put my JavaScript program in the cloud9 autorun folder so that it starts up automatically on boot. This piece is working just fine.

I added an insert.php program to take user input from the html and store it in a sql database. The .php script works when I directly access by hosting it with apache but it does not work when I access it from html page. My question is this: Where in the file structure do I place the insert.php program; can it run within the cloud9 folder where my html file is located?

I will post my code later for reference. Thank you.