Home >Backend Development >PHP Tutorial >Permission issues for sqlite database reading and writing under Linux

Permission issues for sqlite database reading and writing under Linux

WBOY
WBOYOriginal
2016-08-08 09:22:452021browse

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
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

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

chmod g+w db.sqlite

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

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

Change the file owner

chown www-data db.sqlite

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.

Statement:
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