I am working on a web app that needs read/write access to an SQLite database file. As I understand it, the parent folder needs to be set to 777 in order to be able to open the database with PHP (source).
What are the recommended file permissions for the .db file itself? Bear in mind that I need to be able to overwrite the file with PHP as well.
Furthermore, are there any security risks with the database if its parent is 777? The folder is created by PHP. I’m just trying to make sure I can get work done without creating security risks.
Thanks!
You should have Apache (the web server) own the folder.
Or maybe create a group like
www-devconsisting of MySQL and Apache and then set the folder group towww-devand the permissions to770.Just don’t make the folder public with 777 – specially on a shared server.