Can't view PDFs, 5xx Server Error

Let’s get the obvious out of the way:

Version 7.8.26
Sugar Version 6.5.25 (Build 344)
Linux
PHP 7.0
CentOS 7

Okay, I thought upgrading to a newer version of SuiteCRM would fix my problem but it hasn’t. I was having problems viewing PDF documents after they were uploaded and I was under the impression the new LTS version would fix it. It did not. Every time I upload a document if appears in the document section, but when I click the file for view, I get an 500 internal server error. I’m stumped. Here’s what I know.

The documents are correctly uploaded.
When I attach the pdfs to emails, they appear correctly to recipients.
I can see the document references in my upload folder.

I would like to be able to view them from inside SuiteCRM, is there anyone who can help me troubleshoot this problem?

Hi,
Have you set the permission for files and folders? and also in Config file?
I think you need to set the permissions.
And also please check the suitecrm.logs and apache logs to get more information of the error.

My permissions are good. I just did an upgrade. All appropriate files are writable. Here’s the log…

[03-Feb-2019 05:21:58 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mime_content_type() in /home/rtrdigital/public_html/portal/download.php:183
Stack trace:
#0 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(871): require_once()
#1 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(402): SugarController->handleEntryPoint()
#2 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(315): SugarController->process()
#3 /home/rtrdigital/public_html/portal/include/MVC/SugarApplication.php(105): SugarController->execute()
#4 /home/rtrdigital/public_html/portal/index.php(52): SugarApplication->execute()
#5 {main}
thrown in /home/rtrdigital/public_html/portal/download.php on line 183
[03-Feb-2019 05:22:36 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mime_content_type() in /home/rtrdigital/public_html/portal/download.php:183
Stack trace:
#0 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(871): require_once()
#1 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(402): SugarController->handleEntryPoint()
#2 /home/rtrdigital/public_html/portal/include/MVC/Controller/SugarController.php(315): SugarController->process()
#3 /home/rtrdigital/public_html/portal/include/MVC/SugarApplication.php(105): SugarController->execute()
#4 /home/rtrdigital/public_html/portal/index.php(52): SugarApplication->execute()
#5 {main}
thrown in /home/rtrdigital/public_html/portal/download.php on line 183
[03-Feb-2019 05:27:10 UTC] PHP Warning: Smarty error: Missing required field:file in /home/rtrdigital/public_html/portal/include/Smarty/Smarty.class.php on line 1094
[03-Feb-2019 05:27:12 UTC] PHP Warning: Smarty error: Missing required field:file in /home/rtrdigital/public_html/portal/include/Smarty/Smarty.class.php on line 1094

This whole thing was solved because I was missing a PHP extension in server configuration. I’m surprised there was no alert during the installation process. The missing extension was PHP File.

1 Like

Thanks for updating the thread here.

I think there is a check in the installer, but not in the upgrader.

It is possible that you installed with an earlier version of PHP that had the necessary extension, but then upgraded PHP and lost that particular configuration, before doing the SuiteCRM upgrade.