LeonLatex Posted March 10, 2023 Share Posted March 10, 2023 I am reading a book about PHP and came into a problem. I can translate it well from English to Norwegian, it's not that. It's because of a lack of information and things the writer has not said/ given enough information about, or I can have overseen it. Anyway, I can't find the answer anywhere in the book. So, please help me out here. In the English text below, do they mean a level up outside the www directory when they say up a level? Do they mean I have to create i new directory/folder outside the www directory/folder named "project, or is the project directory/folder? This is in connection with security and should ensure that visitors to a website do not get direct access via the web browser to the file "count.html.php .Can anyone tell me what is meant here? Β "This is the text: Go ahead and move count .html.php up a level into the project directory and amend count.html.php to reference the new location".Β Thankful for a explanation ππ Quote Link to comment Share on other sites More sharing options...
Solution kicken Posted March 10, 2023 Solution Share Posted March 10, 2023 The document root of your project should be a sub-directory within your project, rather than the project folder itself.Β project βββ www βββ count.html.php βββ index.php They are saying to move that file out of the document root sub-directory and put it into the project folder itself. project βββ count.html.php βββ www βββ index.php Since the document root of the web server would point to the www sub directory, the count.html.php file is now inaccessible by any url. 1 Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted March 10, 2023 Author Share Posted March 10, 2023 As I thought but I was soooo unsure because it was so poorly explained for me.Β But anyway, thanks again. Quote Link to comment Share on other sites More sharing options...
maxxd Posted March 10, 2023 Share Posted March 10, 2023 If the book is recommending using `.html.php` as a file extension, I'd question the quality of the book to be honest. I haven't seen a reference recommend that in... well, years I think. Quote Link to comment Share on other sites More sharing options...
kicken Posted March 10, 2023 Share Posted March 10, 2023 28 minutes ago, maxxd said: If the book is recommending using `.html.php` as a file extension, Given the recommendation to move it out of the document root, I'm assuming they are using that extension for a template file where PHP itself is the template language.Β Symfony uses the same extension if you opt to use raw PHP templates instead of twig ones. If that's not the case though, then yea that extension seems silly. Quote Link to comment Share on other sites More sharing options...
maxxd Posted March 11, 2023 Share Posted March 11, 2023 Good point, and now that I think about it Laravel uses `.blade.php` - which, to be honest, I've always found a bit silly. Just use twig... Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted March 11, 2023 Author Share Posted March 11, 2023 5 hours ago, maxxd said: If the book is recommending using `.html.php` as a file extension, I'd question the quality of the book to be honest. I haven't seen a reference recommend that in... well, years I think. It's not a recommendation. Who told you that? This is taken from one of the first chapters describing/teaching about how it's possible to do an html or php site/file unreadable for visitors of the site by direct access through the browser. This chapter also describes he use of templates and the In later chapters, they are changing this to the "normal way". It's just to do It more readable and understandable for the reader. So, since I am reading and learning from the book (and the other freaks in here) I feel I am more appropriate to rate this bookΒ than one who has not. But, out on your experience and knowledge, I understand your reaction. It's easy to be the first in line to throw the first word about something or somebody. The book Is good. And I learn a lot from it. Some chapters I have to use more time on, but that is my own fault, not the book. Maxxd, I wish you a beautiful Saturday morning, day, and evening. Greetings from Thailandπ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.