500 Server Error - Viewing PDF and Creating Invoices on InvoiceNinja v5 Self Hosted

Whenever I try to view any PDF, it shows me a PDF, but the content of the PDF just says 500 - Server Error. Similarly when I try creating a new invoice, it just says 500 - Server Error.

I have tried changing the setting to snappdf and also reverted to phantom with a personal secret added to ensure its not a limits issue. However, nothing has changed.

I am not using cloudflare and I dont see any other reason why the pdf creation or generation should fail.
Any help would be appreciated.

TLDR Solution:

  1. Ensure that you have enabled allow_url_fopen in your php settings
  2. Ensure that you are NOT using snappdf


I suggest using the health check option in the app to ensure your changes are taking effect.

I discovered that option after making the original post, but all parameters had green checkmarks on them.
However, I had to use v5.3.21 to setup as the latest version wasnt allowing me to reach the setup screen (gave me a 500 Internal Error). So I clicked force update out of curiosity and I’m back to the 500 Internal Error. Not sure what’s causing it. Have to fix that before I can come back to pdf generation errors. Any thoughts?

I’m not referring to the green checkmarks. You mentioned you tried changing the .env value, I’m suggesting using the health check to ensure your new values were applied. You may need to run php artisan optimize.

Thank you for the prompt replies. I tried to run php artisan optimize, but it gave me the following error:
In Company.php line 29: Trait ‘Awobaz\Compoships\Compoships’ not found

Also, on refreshing the page, it still gives me a 500 Server Error

It may help to first run composer install

Which version are you using?

I had freshly installed v5.3.69, but that gave me a 500 error directly and didnt even let me hit the home page or install it. So I installed the last known working version for me, which was v.5.3.21 (by chance, and not by trial and error of all versions between them).

The issue is that while fiddling around with v5.3.21, curiosity got the better of me and I clicked “Force Update” on the health status page and it updated to v5.3.70 which straight up gave me a 500 error and I couldnt find any way to revert the upgrade.

@david do you have any suggestions?


most likely your system is not able to run the composer installation, in these instances, you’ll want to copy the full package


and overwrite your existing files (ensure you backup your .env file first!)

I would like to also chime in that I am receiving a 500 server error, and the logged error is:

mod_fcgid: stderr: PHP Fatal error: Trait ‘Awobaz\Compoships\Compoships’ not found in /home/user/website/app/Models/Company.php on line 29, referer: https://www.website.com/flutter_service_worker.js?v=5.3.68

Also with version 5.3.70. The way I do the updates is to overwrite the files with https://github.com/invoiceninja/invoiceninja/archive/refs/tags/v5.3.70.tar.gz

Noticed that a 5.3.71 version was just uploaded. I overwrote the files with 5.3.71 but still getting the same error


can you try overwriting with this file please


Ok, I will try it, thanks. But would like to point out that downgrading to 5.3.68 brings me back to operation. 5.3.69 is the version when I can no longer just extract the version.tar.gz files and keep running.

Edit: By “downgrading” I mean extracting the v5.3.68.tar.gz files to the website folder

Okay, so I unziped the invoiceninja.zip, rewriting all files. When I try to load https://www.website.com/update?secret=TheSecretForTheWebsite, it gives me a 500 error. But accessing www.website.com does load a page, but when I go to “about” it is still in 5.3.68, even though the VERSION.txt is 5.3.70.

I again unziped everything to the folder, overwriting everything, but still… for some reason the page “about” says 5.3.68, and the update?secrete page gives the 500 error. The error.log entry is the same as before. Not sure if I’m messing up somewhere, but if I am, not sure where

I deleted the folder, and unzipped invoiceninja.zip, inserted the .env backup, and that seems to get it running. Did I removed anything from the original files that I should replace from my backup to this new installation?

Unfortunately I can’t get any pdfs. It gives me a pop up that says Error 500: I ran php artisan optimize and completed successfully, but the error persists. I also did the update?secret page, and seems to have worked, but the pdf error persists.


This makes sense. New packages were added in 5.3.69, so if your system pulls in the v5.3.69.tar.gz file it relies on your system being able to do composer install.

Some shared hosts do not allow the composer install command to run so the installation will fail due to missing packages. In these cases the larger invoiceninja.zip file is required as it contains the full system pre-built.

Ok. I believe I can install composer on my system (but I don’t have it right now). I will try to install composer an try again the update from 5.3.68.

When I did the fresh unzip and included the .env backup, I could run the 5.3.71, but could not get pdf working (even after php artisan optimize). What could be the culprit there?

I have installed composer, but still the extracting the 5.3.72.tar.gz gives me the 500 error. Do I also have to provide a composer command?

Edit: To clarify, I have a fully working 5.3.68 installation, and I try to update by extracting the 5.3.72.tar.gz file into the directory. When I try to access the site it gives a 500 error with error.log entry same as previously posted in this thread


If you use the .tar.gz file, then after extracting you need to run

composer install -o --no-dev

Happy to report that running the composer command fixed the installation. PDF creation working well too, and no whitelabel issue (with 5.3.73).

Previously I was not running the composser command and the update still worked. Should this command be run everytime I use the .tar.gz file regardless?