shkdee / KeePassPHP

A port of KeePass Password Safe in PHP
MIT License
74 stars 23 forks source link

Database add Error on RH 6.3 server #1

Closed dbabault closed 11 years ago

dbabault commented 11 years ago

Bonjour,

I'm unable to open a test database, in debug mode :


Debug trace: KeePassPHP application started ! Attempting to load database from /tmp/phpc1VBoh

... attempt succeeded !

but I have a message


Une erreur est survenue : File upload failed unexpectedly.

shkdee commented 11 years ago

Thanks for reporting, but now I realize the debug info is not at all verbose enough to debug other people's problems. Just to be sure, are you using a script of yours directly calling KeePassPHP, or are you using the UI I've tried to make ?

In the second case, I have to carry out more tests because I did not manage to reproduce the problem. But it seems to me that this has something to do with PHP and file permissions: the file has been correctly uploaded in the temp dir (which is PHP normal behavior), and KeePassPHP managed to "load" (i.e read, decrypt and parse) this temp file, as it claims in the debug trace. After that, it tried to move it from the temp dir to its definitive location (with the PHP function move_uploaded_file), and there came the problem: either the target directory is not writable for PHP (it should be keepassphp/data/secure/kdbx/ I think, and keepassphp/data/secure/key/ for key files if you tried to use one), or move_uploaded_file could not move it for some reason. Can you check whether setting writing permission to this directories solves the problem ?

shkdee commented 11 years ago

Or, wait, right, maybe these directories do not exist at all in your system... since they were empty, there were not sent to github. Try to create the three missing directories: "keepassphp/data/secure/key/", "keepassphp/data/secure/kdbx/", and "keepassphp/data/secure/kphpdb/" also), and make sure PHP can read and write into them... It's true that KeePassPHP does nothing to fix such a small setup problem, whereas it detects it. This will be fixed...

dbabault commented 11 years ago

Thanks, I create directories, but problem still there,

in uploadmanager.php, $this->acceptFiles is empty, if I force $this->acceptFiles = true; in addElements, I can continue, an open the Database.

Daniel

dbabault commented 11 years ago

But I don't see anithing

dbabault commented 11 years ago

Capture

shkdee commented 11 years ago

If the database appears to be empty, this is because the two "default" entries are not in groups. I ran into the same problem one hour ago when I tried to reproduce the previous bug: this happens because I did not know that some entries could be defined outside from groups in the kdbx file, so KeePassPHP just ignores them. This will be fixed also.

But it is weird that $this->acceptFiles be empty. It is defined in filemanager.php: if the target dir exists, and is writeable and readable, it clearly should be true. What are the permissions of the directories inside keepassphp/data/secure ?

dbabault commented 11 years ago

So, I made a typo secure/kbdx must be secure/kdbx, and I have to create data/icons

Now all is OK

Thanks a lot