0

I have created a php desktop app withe sqlite and a setup file using inno setup. all is ok but I can't add or edit data into sqlite db using same php code after installing setup file that I have made with the working code. Its showing Errroe adding record. Read only file Mind it, before creating setup file I can add or edit dat into sqlite. anyone can help?

Gazi
  • 1
  • 1
  • Can you clarify your question? Why can't you add or edit data? Is it a connection problem? What kind of error message are you receiving? How do access the database - can you show us your code? – ventiseis Sep 27 '17 at 19:03
  • Thanks. after creating setup file using php desktop the sqlite db became read only. that's why I can't add data in sqlite. connection is ok, I can login to system using existent username and password. When I try to add data to sqlite it's show error message like "SQL error: attempt to write a readonly database" – Gazi Sep 28 '17 at 02:44
  • So, where do you put your database file? Do you have write permissions to that folder? – ventiseis Sep 28 '17 at 06:32
  • I kept database file in the same folder where I KEPT my other php file. After installing php desktop setup file I found my all php script is running well. but it can't write or edit database file or can't insert data on db. I don't understand write permission to folder. but i can access to all folder and file. This problem occur only after I create a setup file and install it. after installing setup file when I run the app it can't write or edit database file or can't insert data on db. – Gazi Sep 28 '17 at 06:49
  • All is ok but when I install this php desktop setup file inside "Program Files (x86) or Program Files" then it don't work. If I install this on any newly create folder then it work fine. can you help me to install it on "Program Files (x86) or Program Files" ??? – Gazi Sep 28 '17 at 13:15
  • The mentioned folders are write protected. You could create a custom folder under `ProgramData`, for example. – ventiseis Sep 28 '17 at 18:24
  • See https://stackoverflow.com/questions/11982760/inno-setup-makes-sqlite3-database-read-only, or https://stackoverflow.com/questions/3319112/sqlite-read-only-database. Look other user have the same problem! – ventiseis Sep 28 '17 at 18:25
  • Thanks. It resolved when I install it on other folder. But I was looking for if there is anyway to install it on "Program Files / (x86)" folder. – Gazi Sep 30 '17 at 02:37

1 Answers1

0

I had the same problem. I have solved in this way. -> Download TakeWonership from this link: https://www.top-password.com/take-ownership-pro.html then install it. Then you will find this option in the command bar.

enter image description here

-> find the project folder and hit the take ownership option

enter image description here

-> Now uncheck the read-only option from the folder properties.

enter image description here

Then your problem should be solved.. if not then open the project folder and uncheck read-only for all folders individually along with the database file. This works for me.