Unable to load Calendar and Documents

Situation
When open the system the Calendar page is not loading. Instead it gives me an Error posted below. The same Error happens when I try to go to Documents. Everything else is working OK. The openemr folder and subfolders are root:root with 755 permissions. The Smarty.class.php I changed to local user:local user with 666 permissions. The problem persists.

**OpenEMR Version
I’m using OpenEMR version 7 (1)

Browser:
I’m using: Chrome

Operating System
I’m using: Ubuntu 20.04 LTE

Logs
Did you check the logs?
Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All

Fatal error : Smarty error: unable to write to $compile_dir ‘/home/admin/domains/drhinov.com/public_html/openemr/sites/default/documents/smarty/main’. Be sure $compile_dir is writable by the web server user. in /home/admin/domains/drhinov.com/public_html/openemr/vendor/smarty/smarty/libs/Smarty.class.php on line 1099

try setting apache2 aka www-data with sudo chown -R www-data:root <openemr webroot>

Thank you. I changed it as recommended and now the owner is www-data and the group is root. It does not change the error. Still the same problem persists.

Hopefully you tried clearing Smarty cache. If permissions are wrong I’d expect it to fail.

I did. The message is:
Error: folder ‘/home/admin/domains/drhinov.com/public_html/openemr/sites/default/documents/smarty/main’ not writeable!
Smarty Cache has been cleared

Delete the directory sites/default/documents/smarty and let openemr recreate and see if it allows

Also check what the User/Groups are for the openemr directory tree. Is it www-data/root?
I’ve sometimes have seen ubuntu/ubuntu.

if I rename smarty directory the OpenEmr log in page is not opening. If I try to run a setup.php to recreate the directory it is not responding as well. I checked the smarty and main directory permissions as well as the files in the main directory permissions and they all are www-data:root for owner/group
When I rename the smarty directory back everything is back to the previous state.

Was this working? Is new install or production? You really should not be running openemr in root but instead www-data/www-date or even www-data/root maybe depending how www-data is config’ed.

Doubtful openemr has root permissions as it is an app.

I have been restoring the system after a disaster. I have a back up zip files and back up sql files from the old system.
I have been trying to work on it every possible way. This particular tryout is a new install on OpenEmr 7.0 followed by import of the sql database with replacement of the sites/default/document folder from the zip backup file.
I am sure all this messes up permissions.
My backups are from version 6.1.0 and this could also contribute to my problems. I tried to update the database with sql_update.php with improves the situation some.
Current status is the best I came up with.

Did you successfully do @stephenwaite suggestion from openemr root? What are the current directory owner/groups i.e from openemr root directory ls -la ?

root@server-xxxxxxxx:/home/admin/domains/drhinov.com/public_html/openemr# ls -la
total 2100
drwxr-xr-x 29 www-data root 4096 Oct 13 13:17 .
drwxr-xr-x 6 admin admin 4096 Oct 13 12:46 …
-rw-r–r-- 1 www-data root 22160 Jul 18 21:04 acknowledge_license_cert.html
-rw-r–r-- 1 www-data root 58965 Jul 18 21:04 acl_upgrade.php
-rw-r–r-- 1 www-data root 10567 Jul 18 21:04 admin.php
-rw-r–r-- 1 www-data root 27016 Jul 18 21:04 API_README.md
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 apis
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 bin
-rw-r–r-- 1 www-data root 5269 Jul 18 21:04 build.xml
drwxr-xr-x 5 www-data root 4096 Oct 13 13:15 ccdaservice
drwxr-xr-x 4 www-data root 4096 Jul 18 21:04 ccr
drwxr-xr-x 17 www-data root 4096 Jul 18 21:04 ci
-rw-r–r-- 1 www-data root 124 Jul 18 21:04 cloudbuild.yaml
-rw-r–r-- 1 www-data root 5526 Jul 18 21:04 CODE_OF_CONDUCT.md
-rw-r–r-- 1 www-data root 4427 Jul 18 21:04 composer.json
-rw-r–r-- 1 www-data root 475624 Jul 18 21:04 composer.lock
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 config
drwxr-xr-x 12 www-data root 4096 Jul 18 21:04 contrib
-rw-r–r-- 1 www-data root 28787 Jul 18 21:04 CONTRIBUTING.md
-rw-r–r-- 1 www-data root 109 Jul 18 21:04 controller.php
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 controllers
drwxr-xr-x 3 www-data root 4096 Jul 18 21:04 custom
drwxr-xr-x 10 www-data root 4096 Jul 18 21:04 docker
-rw-r–r-- 1 www-data root 2214 Jul 18 21:04 DOCKER_README.md
-rw-r–r-- 1 www-data root 2 Jul 18 21:04 docker-version
drwxr-xr-x 5 www-data root 4096 Jul 18 21:04 Documentation
-rw-r–r-- 1 www-data root 129 Jul 18 21:04 .editorconfig
-rw-r–r-- 1 www-data root 80 Jul 18 21:04 .env.example
-rw-r–r-- 1 www-data root 15499 Jul 18 21:04 FHIR_README.md
drwxr-xr-x 6 www-data root 4096 Jul 18 21:04 gacl
drwxr-xr-x 4 www-data root 4096 Jul 18 21:04 .github
-rw-r–r-- 1 www-data root 428 Jul 18 21:04 .gitignore
-rw-r–r-- 1 www-data root 23074 Jul 18 21:04 gulpfile.js
-rw-r–r-- 1 www-data root 917 Jul 18 21:04 index.php
drwxr-xr-x 35 www-data root 4096 Jul 18 21:04 interface
-rw-r–r-- 1 www-data root 6321 Jul 18 21:04 ippf_upgrade.php
drwxr-xr-x 14 www-data root 4096 Oct 13 13:15 library
-rw-r–r-- 1 www-data root 35147 Jul 18 21:04 LICENSE
drwxr-xr-x 3 www-data root 4096 Jul 18 21:04 modules
drwxr-xr-x 4 www-data root 4096 Jul 18 21:04 oauth2
-rw-r–r-- 1 www-data root 3524 Jul 18 21:04 package.json
-rw-r–r-- 1 www-data root 693653 Jul 18 21:04 package-lock.json
-rw-r–r-- 1 www-data root 2178 Jul 18 21:04 phpunit.xml
drwxr-xr-x 9 www-data root 4096 Oct 13 13:15 portal
drwxr-xr-x 8 www-data root 4096 Jul 18 21:05 public
-rw-r–r-- 1 www-data root 3021 Jul 18 21:04 README.md
-rw-r–r-- 1 www-data root 22585 Jul 18 21:04 _rest_config.php
-rw-r–r-- 1 www-data root 476705 Jul 18 21:04 _rest_routes.inc.php
-rw-r–r-- 1 www-data root 26 Jul 18 21:04 robots.txt
-rw-r–r-- 1 www-data root 0 Aug 7 05:42 setup.php
drwxr-xr-x 3 www-data root 4096 Jul 18 21:04 sites
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 sphere
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 sql
-rw-r–r-- 1 www-data root 17598 Jul 18 21:04 sql_upgrade.php
drwxr-xr-x 28 www-data root 4096 Jul 18 21:04 src
-rw-r–r-- 1 www-data root 303 Jul 18 21:04 .stylelintignore
-rw-r–r-- 1 www-data root 744 Jul 18 21:04 .stylelintrc.json
drwxr-xr-x 2 www-data root 4096 Jul 18 21:04 swagger
drwxr-xr-x 21 www-data root 4096 Jul 18 21:04 templates
drwxr-xr-x 8 www-data root 4096 Jul 18 21:04 tests
drwxr-xr-x 60 www-data root 4096 Jul 18 21:04 vendor
-rw-r–r-- 1 www-data root 2089 Aug 7 05:42 version.php

Can you do following commands members root and members www-data and for grins members ubuntu

what about the subdirectories of openemr, that the -R recursive chown would help with

members root gives nothing
members www-data gives only www-data
members ubuntu said members: group ubuntu does not exist

I can run sudo chown -R www-data:root on openemr if you feel it will help

it’s the subdirectory of openemr, sites/default/documents/smarty

I just checked and the openemr/sites/default/documents/smarty is www-data:root with permissions to owner to r and w and group to only r

subdirectory of smarty, main, too?

Yes. The same settings for the main subdirectory