I installed Ubuntu 14.04 and Apache.
It seems I should place my web site files in the "/var/www/html" directory.
But then where should I place my backend PHP files?
For example, if I have web site forms that will on submit make a request to a backend PHP file, should I put the PHP file in "/var/www/php" and have, for example, the "/var/www/html/index.html" file form action refer to "../test.php"?
I don't want people in general to have access in the browser to my PHP files, which is why I feel they should be above "/var/www/html", but if that is the web root, how can "../test.php" work?
Best Answer
Generally PHP files are meant to be accessed by the general public. For example, index.php resides in /var/www/html and handles all requests for "/". If your app file is test.php, then try placing it in /var/www/html/test.php and you can browse to it directly.
As long as you have mod-php5 loaded and enabled, apache will execute that script instead of returning the source code.