Uncaught Exception: Message: Temporary files directory "//invoiceplane/uploads/temp/mpdf//mpdf not writable

Getting this error when clicking the download the pdf

An uncaught Exception was encountered

Type: Mpdf\MpdfException

Message: Temporary files directory "/usr/share/webapps/invoiceplane/uploads/temp/mpdf//mpdf" is not writable

Filename: /usr/share/webapps/invoiceplane/vendor/mpdf/mpdf/src/Cache.php

Line Number: 21


File: /usr/share/webapps/invoiceplane/vendor/mpdf/mpdf/src/ServiceFactory.php
Line: 67
Function: __construct

File: /usr/share/webapps/invoiceplane/vendor/mpdf/mpdf/src/Mpdf.php
Line: 1083
Function: getServices

File: /usr/share/webapps/invoiceplane/application/helpers/mpdf_helper.php
Line: 45
Function: __construct

File: /usr/share/webapps/invoiceplane/application/helpers/pdf_helper.php
Line: 105
Function: pdf_create

File: /usr/share/webapps/invoiceplane/application/modules/invoices/controllers/Invoices.php
Line: 272
Function: generate_invoice_pdf

File: /usr/share/webapps/invoiceplane/index.php
Line: 329
Function: require_once


The error message says the following:

Temporary files directory “/usr/share/webapps/invoiceplane/uploads/temp/mpdf//mpdf” is not writable

So … first make sure that directory exists
Then make sure the outside world cannot see that directory (check other directories in the uploads directory for examples

Now … there are sone threads on mpdf’s temporary directory:

It might help you configure a better directory than InvoicePlane’s uploads directory

I’ve been staring at this thing for days trying to work it out ls -la showed correct permissions,
yep stupid here created


instead of


yep I copied and pasted.

thanks away

Does this mean you solved your own problem?
That’s awesome

Yep it’s fixed,

I don’t know if this helps anyone or it’s relevant on all distros:

Since version 7.4 php-fpm is hardened per default and revokes read/write access on /usr (and sub-directories). Therefore it is also necessary to explicitly give permissions on /usr/share/webapps/invoiceplane directories.

Create a drop-in file for php-fpm.service.

Add and save it with the following content:


ReadWritePaths = /usr/share/webapps/invoiceplane/ipconfig.php
ReadWritePaths = /usr/share/webapps/invoiceplane/uploads/
ReadWritePaths = /usr/share/webapps/invoiceplane/application/logs
ReadWritePaths = /usr/share/webapps/invoiceplane/vendor/mpdf/mpdf/tmp

and since invoiceplane supports php81 change the directory to php81-fpm for the drop-in file

( and don’t copy and paste things can go wrong LOL )


1 Like