I am trying to host an index.php page on a Linux Server running Apache. I am very familiar with hosting Html/Css websites but am not that knowledgeable about hosting php pages. Do I have to enclose php scripts within html tags and index.html page or can my home page be index.php? How the various directories and includes should be placed on the web page for the server to execute it properly? Many thanks!
PHP script must be enclosed in at least an opening tag <?php. Your index page can be index.php. In fact, most dynamic sites using PHP have index.php as their main page. If you want to process files with .html with the PHP engine, you will have to add a handler in your sever config or htaccess file. As for file includes, you can specify file paths relatively or absolutely. The choice is yours, really, to which you prefer. Some people are adamant about using absolute file paths and others prefer to use relative file paths in case they have to move their site to another server, assuming the scripts are all located under the /public_html folder.
Do like I did long ago, cheat.... I used a WordPress theme to learn things, structure, includes, etc....
Basically, anything you can do in .html, you can do with .php. Also, if the file is a pure html-file, renaming it to php won't do anything, except you will then be running it through the php engine, which might make it a teeny, tiny bit slower. So you don't want to do that. You can perfectly fine mix .html and .php, but (usually) you CANNOT mix index.html and index.php - the server will normally default to the .html-file, which will mess up your system. As for includes, you can easily include anything that is within the web root folder. If your index.php is in the root folder of your site, having your script-files in a folder named script in the same directory, you'd include a file from that directory via include('script/filename.js') or include('/script/filename.js') (the extra beginning / will tell the include to look for the file at the root of the website, so it will work even if you try to include the file from inside some other subfolder on the site. You can also do includes via php either by doing include_once(), require(), or require_once().