# Error when pulling up docs in Visit History tab

**URL:** <https://community.open-emr.org/t/error-when-pulling-up-docs-in-visit-history-tab/26691>\
**Category:** Support\
**Created:** [April 7, 2026, 3:31pm UTC](https://community.open-emr.org/t/error-when-pulling-up-docs-in-visit-history-tab/26691 "2026-04-07T15:31:24Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![cgreen](https://community.open-emr.org/letter_avatar_proxy/v4/letter/c/77aa72/32.png) [@cgreen](https://community.open-emr.org/u/cgreen)\
**Post date:** [April 21, 2026, 3:51am UTC](https://community.open-emr.org/t/error-when-pulling-up-docs-in-visit-history-tab/26691/6 "2026-04-21T03:51:00Z")

</div>

This patch also worked for us, thank you.

After replacing encounters.php with this version we experienced a 500 Internal Server Error - the relevant log entry is reproduced below. The solution was to correct the permissions in the documents directory, as described in issue 26598:

> [@Cannot upload documents openemr 8.0](https://community.open-emr.org/t/cannot-upload-documents-openemr-8-0/26598/2):
>
> sudo chown -R www-data:www-data /var/www/html/openemr/sites/default/documents  
> sudo chmod -R 775 /var/www/html/openemr/sites/default/documents

Apache error for Google-ability:

[php:error] [pid 3565:tid 3565] [client 10.6.0.2:33782] PHP Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::\_\_construct(/data/www/html/openemr/sites/default/documents/smarty/main/%%1E): Failed to open directory: Permission denied in /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_method\_clearcompiledtemplate.php:76\nStack trace:\n#0 [internal function]: RecursiveDirectoryIterator-\>\_\_construct()\n#1 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_method\_clearcompiledtemplate.php(76): RecursiveDirectoryIterator-\>getChildren()\n#2 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_extension\_handler.php(133): Smarty\_Internal\_Method\_ClearCompiledTemplate-\>clearCompiledTemplate()\n#3 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_data.php(270): Smarty\_Internal\_Extension\_Handler-\>\_callExternalMethod()\n#4 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_template.php(494): Smarty\_Internal\_Data-\>\_\_call()\n#5 /data/www/html/openemr/sites/default/documents/smarty/main/a6ecfa90bb83cc9a6bdd321dfcc14d47b6e46513\_0.file.general\_view.html.php(6): Smarty\_Internal\_Template-\>\_decodeProperties()\n#6 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_template\_compiled.php(148): include(‘…’)\n#7 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_template\_compiled.php(105): Smarty\_Template\_Compiled-\>process()\n#8 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_template.php(217): Smarty\_Template\_Compiled-\>render()\n#9 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_templatebase.php(238): Smarty\_Internal\_Template-\>render()\n#10 /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_templatebase.php(116): Smarty\_Internal\_TemplateBase-\>\_execute()\n#11 /data/www/html/openemr/controllers/C\_Document.class.php(586): Smarty\_Internal\_TemplateBase-\>fetch()\n#12 /data/www/html/openemr/library/classes/Controller.class.php(157): C\_Document-\>view\_action()\n#13 /data/www/html/openemr/controller.php(6): Controller-\>act()\n#14 {main}\n thrown in /data/www/html/openemr/vendor/smarty/smarty/libs/sysplugins/smarty\_internal\_method\_clearcompiledtemplate.php on line 76, referer: https://[siteURL]/openemr/interface/patient\_file/history/encounters.php

---

_[View the full topic](https://community.open-emr.org/t/error-when-pulling-up-docs-in-visit-history-tab/26691)._
