Cannot access documents after 6.0 upgrade

The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it. /home/mysite/public_html/emr/sites/default/documents/1/20210329125447_001.pdf

I tried changing permission on the folder but still get the error.

You can eliminate permission issue as root cause by uploading and then viewing a new file.

If you are able to do that, you may have mismatch in link(s) stored in documents table prior to your upgrade. That can be confirmed by listing the directory using console or any operating system tool.
ls -l /home/mysite/public_html/emr/sites/default/documents/1/

make sure you:

chown -R apache:apache /home/mysite/public_html/emr/sites/default/documents/

yes, the hash does not mash. How can I fix it?

I also updated my test site first and it works.

Are you able to view the files in their original state?
We probably need to ask someone like @adunsulag or @sjpadgett about the details.

Here is the procedure I used for my upgrade and my files could be viewed. I did not encrypt the document files at the Ubuntu/Docker file system level (the disk storage itself is encrypted on the systems I use):

I have all the files in test and can open them in my test emr. Is there any way to transfer the hash from the test database to the production database.

@tjbarr What version were you on before you upgraded OpenEMR? Do you have a backup of your database before the upgrade?

Is your test database a copy of your production database? You would need to copy over all of your security keys, database keys, and the files from the test system to production in order to make them match. This could be done, but you may need a vendor to assist you with this. I’m not familiar with the documents upgrade process from 5.0.2, but I do know if you provide more details on your system environment and what steps you took that someone on the forum will be able to provide more assistance.

5.2. I have a copy from 3 days ago because I didn’t notice that the documents weren’t working for a day or 2. I am thinking of using the 3 day old database and copying over the records from the new database that were added after the update.

That may be easier. I don’t k now where the security and database keys are kept in the database.

Not sure what steps you followed but are you able to work with new documents (add, move and delete) in the installation you are having problems with? If not, your documents directory location and/or permissions are incorrect.

If problem is limited to old documents and directory location+permissions are correct, then you probably changed the root for emr software during the upgrade. Make sure directory /home/mysite/public_html/emr/sites/default/documents/ exists with all documents if your emr scripts are in /home/mysite/public_html/emr/directory as they were prior to the upgrade. Developer elected to store absolute path for each document in the database. That means if old directory structure is not replicated, you get error(s).
If you changed directory structure during upgrade, you will have to fix the entries in documents table.

What is the name of the documents table?

Location is stored in ‘url’ field in ‘documents’ table.

The urls in that table are correct.

Also the hash column match. hmmmm.

I got it working with another backup. Thanks

2 Likes