Permission issues for sqlite database reading and writing under Linux

WBOY
Release: 2016-08-08 09:22:45
Original
1982 people have browsed it

I am learning Linux recently, and I happened to have a PHP project to do, so I configured the environment and planned to do it under Linux.

Unfortunately, the website went blank after running. After debugging, it was found that it was a problem with the sqlite database.

Install the sqlite extension

apt-get install php5-sqlite
Copy after login
Check the /var/log/apach2/error.log log file and find the following line

SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
Copy after login

It seems that there is no write permission, chmod changes the permission to writeable

chmod g+w db.sqlite
Copy after login

It still doesn’t work, It prompts that the data file cannot be opened

SQLSTATE[HY000]: General error: 14 unable to open database file
Copy after login

Change the file owner

chown www-data db.sqlite
Copy after login

This time it is already possible. But if you find this too troublesome, you can directly change the permissions to 777

The above introduces the permission issues of sqlite database reading and writing under Linux, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template