I have a SQLite database that I am using for a website. The problem is that when I try to INSERT INTO
it, I get a PDOException
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
I SSH'd into the server and checked permissions, and the database has the permissions
-rw-rw-r--
I'm not that familiar with *nix permissions, but I'm pretty sure this means
- Not a directory
- Owner has read/write permissions (that's me, according to
ls -l
) - Group has read/write permissions
- Everyone else only has read permissions
I also looked everywhere I knew to using the sqlite3
program, and found nothing relevant.
Because I didn't know with what permissions PDO is trying to open the database, I did
chmod o+w supplies.db
Now, I get another PDOException
:
SQLSTATE[HY000]: General error: 14 unable to open database file
But it ONLY occurs when I try to execute an INSERT
query after the database is open.
Any ideas on what is going on?
I got this in my browser when I changed from using http://localhost to http://my.local.ip.address and then changed back to localhost -- it was necessary to stay with the IP address once I had changed to that once