chuushi / CoreProtect-Lookup-Web-Interface

A flexible lookup web interface for CoreProtect 2
MIT License
50 stars 14 forks source link

unable to open database file #32

Open TetraTheta opened 3 years ago

TetraTheta commented 3 years ago

I don't get this is bug or my fault.

1
I set up NGINX and PHP, PDO, PDO-SQLITE. PDO and PDO-SQLITE is enabled in php.ini. I think this would be enough to do.
But I tested this like this, I get this error message.

2
14: SQLSTATE[HY000] [14] unable to open database file
Of course, CoreProtect-Lookup-Web-Interface files and database file are in same machine, I set where the CoreProtect database is located in config.php. I think I've done everything I should do to work with this but I can't use this.

Is there anything I need to check else? Is this bug or my fault? If this is my fault, then how can I solve this problem?

chuushi commented 3 years ago

Hi, sorry about getting back at ya a month later ;; It might be either a wrong file path or a permission issue. Can you check if the webserver or PHP has access to the database file? (use ls -l to see if www-data or similar has access to read the file)

TetraTheta commented 3 years ago

database's owner is amp and its group is amp.
the directory where CPLWI located is owned by www-data and it is under group amp and www-data.

I set the database(database.db)'s permission to 0777 which will allow all access to anyone.

Still cannot access database 14: SQLSTATE[HY000] [14] unable to open database file.

Is there anything I need to do further?

tomas-kucera commented 3 years ago

I had the same but did not dare to give 0777. I gave 0744 (rwxr--r--) to files and 0755 (rwxr-xr-x) to directories. This had resolved it.

But I guess that the best would be running MySQL server instead of the SQLite which would eliminate this issue.

TetraTheta commented 3 years ago

But I guess that the best would be running MySQL server instead of the SQLite which would eliminate this issue.

Well, I personally don't like running SQL server because whenever I delete previous world, with SQLite, all I have to do is just delete SQLite database file. But with MySQL, I have to login into MySQL database and delete table stuff which is kind of difficult.
Well, using MySQL would be much more performance efficient I guess but I don't like the idea of 'All-In-One Databases stuff' of MySQL. That's why I still trying to use SQLite if available.

tomas-kucera commented 3 years ago

It maybe easier than you think.

In the config.ymp for CoreProtect, there is this line: mysql-database: database

Just give it a name of your new world. I would use some prefix, for example mccpw_ (Minecraft CoreProtect Wolrld). So in case you would be using the same instance of MySQL for some other things, you will be able to identify them visually.

Then when creating a new world, just rename the mysql-database and then you can delete the whole database without much of work. ;)

TetraTheta commented 3 years ago

Well, that's genious. Maybe I should try that when I start to 'use' CP. Currently it justs run with server, i'm not touching it...

Thanks for the nice info!

Still, the issue isn't solved so I will leave this issue opened. The way tomas suggested is workaround, not solution (even though It seems nice)

tomas-kucera commented 3 years ago

Unfortunately, there is no other solution than either granting the process the privileges by using chmod or using the database.

CP is great, I like it. And this web interface too!