I have a simple website where I want to keep the sqlite database outside web root. I'm calling the database from a php script that looks like that:
try {
$db = new PDO('sqlite:./../backend/database/sqlite.db');
} …
I tried every possible path but nothing works, I just can't connect to the database. It works with a mysql database, but I'd like to stick to sqlite for this project.
What am I missing here?
What user is your php script running as? I'm guessing its probably www:data. Check the file permission to see if www-data (or the user running the php script) has permission to read and write the sqlite DB file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.