# Where should I put PHP files for an embedded SQLite database?

**URL:** <https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938>\
**Category:** Hosting Support\
**Created:** [September 25, 2020, 10:20pm UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938 "2020-09-25T22:20:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon11968455](https://forum.infinityfree.com/letter_avatar/anon11968455/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon11968455](https://forum.infinityfree.com/u/anon11968455)\
**Post date:** [September 25, 2020, 10:20pm UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938/1 "2020-09-25T22:20:37Z")

</div>

I’m working on an open source VueJS web application (with user authentication). I’d like it to be as simple to set up as possible for people when they download it from my GitHub page, so I figured I could use an SQLite for a database and call PHP files in order to handle the data between the Frontend and the Database.

I searched around and the best I found for my case was [this YouTube video](https://www.youtube.com/watch?v=b5Ncv6_D0hU), but I’m not entirely sure if the way the person in it sets up the PHP files is secure / correct.

For the sake of argument, let’s suppose this is my file structure:

![1](https://forum-cdn.infinityfree.net/original/2X/6/63ae9eddcdcaf39faf180d763532fc94469aac45.png)

If I want a folder like this one:

![2](https://forum-cdn.infinityfree.net/original/2X/e/ec281806fc1b6943152251dc23be2c0b7f4701e3.png)

Where should I put it? Outside `htdocs`? Inside? If it’s the latter, am I supposed to use the “Directory Privacy” thing-y in the cPanel to restrict access to the `server` folder? If so, would you still be able to make HTTP requests to the PHP files - doing this, is that even secure?

Haven’t really gotten much experience with web applications. Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![TigerMANEK426](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/tigermanek426/32/12600_2.png) [@TigerMANEK426](https://forum.infinityfree.com/u/TigerMANEK426)\
**Post date:** [September 26, 2020, 10:27am UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938/2 "2020-09-26T10:27:38Z")

</div>

First of all, the `server` folder would have to go inside `htdocs`, file accessing outside of this folder is strictly forbidden. The PHP code inside the folders would be hidden anyway, so you wouldn’t have to worry about that. I have never worked with SQLite before, so I can’t tell you what people would see.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [September 26, 2020, 11:27am UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938/3 "2020-09-26T11:27:03Z")

</div>

Protecting your SQLite database against public access is a very good idea, because you definitely don’t want people to be able to download it. But uploading files outside the htdocs directory is not possible, and PHP can’t access files there either, so that’s not an option.

The setup in your second screenshot works very well for this. In that situation, you can just create a file with the name `.htaccess` in the db folder with the contents `Require all denied` and nobody will be able to access that database through a browser.

---

<div class="post-metadata">

**Author:** ![anon11968455](https://forum.infinityfree.com/letter_avatar/anon11968455/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon11968455](https://forum.infinityfree.com/u/anon11968455)\
**Post date:** [September 27, 2020, 9:33am UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938/4 "2020-09-27T09:33:05Z")

</div>

Thank you very much. This is just what I needed to know! Much love \<3

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 12, 2020, 9:33am UTC](https://forum.infinityfree.com/t/where-should-i-put-php-files-for-an-embedded-sqlite-database/35938/5 "2020-10-12T09:33:07Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
