Hello together. Everytime i try to print a ticket, osTicket opens a blank new tab/ window.
I get the following error:

PHP Fatal error:  Uncaught UnexpectedValueException: DirectoryIterator::__construct(/var/tmp/): failed to open dir: Permission denied in /[...]/include/mpdf/vendor/mpdf/mpdf/src/Cache.php:87
Stack trace:
#0 /[...]/include/mpdf/vendor/mpdf/mpdf/src/Cache.php(87): DirectoryIterator->__construct('/var/tmp/')
#1 /[...]/include/mpdf/vendor/mpdf/mpdf/src/Mpdf.php(9392): Mpdf\\Cache->clearOld()
#2 /[...]/include/class.pdf.php(54): Mpdf\\Mpdf->Output('Ticket-180410.p...', 'S')
#3 /[...]/include/class.ticket.php(3604): mPDFWithLocalImages->output('Ticket-180410.p...', 'S')
#4 /[...]/scp/tickets.php(592): Ticket->pdfExport('Letter', NULL, NULL)
#5 {main}
thrown in /[...]/include/mpdf/vendor/mpdf/mpdf/src/Cache.php on line 87

May you can help me?

kind regards

Sorry but you are not running osTicket. You are running something called "osTicket Free v1.14.2 Patch 3 - Deutsche Version". This is not a version of osTicket distributed by us.

You would want to install the version that we distribute over the version that you are running and see if you can replicate the behavior. If you cannot then the problem is with the 3rd party distribution that you are running.

5 days later

So now the "correct" version ist clean installed without any changes in config, database and without any plugins.. Still the same Error log

@eustec

I see it says failed to open dir: Permission denied check all your permissions/ownership of all files in the osTicket directory (including sub-folders/files).

Cheers.

    @eustec

    Doesn’t matter if you have 777, you need to also check ownership of the files. Ensure the user:group ownership is Apache.

    Cheers.

    a month later

    I have exactly the same error, and I think the problem occurs if osticket is running in a shared hosted environment. The hoster does not allow access to the systems /tmp folder, which is the path which is used by mpdf to create the temporary pdf output. Maybe it is the same problem for you, then ask your hosters support if there is a solution.

    Ok, I have a (temporary) solution now. The problem is not mpdf which would use <path to mpdf>/tmp as default directory. osTickets sets an own tmp when instancing the mpdf using sys_get_temp_dir() which is not writeable in my environment. I changed class.pdf.php to use an own tmpdir and created this folder with chmod 777. Now everything works as expected. Unfortunately I don't know a ways to do this without modification.

    class Ticket2PDF extends mPDFWithLocalImages
    {
    
    	var $includenotes = false;
    
           var $includeevents = false;
    
    	var $pageOffset = 0;
    
        var $ticket = null;
    
    	function __construct($ticket, $psize='Letter', $notes=false, $events=false) {
            global $thisstaff;
    
            $this->ticket = $ticket;
            $this->includenotes = $notes;
            $this->includeevents = $events;
    
    	//parent::__construct(['mode' => 'utf-8', 'format' => $psize, 'tempDir'=>sys_get_temp_dir()]);
        parent::__construct(['mode' => 'utf-8', 'format' => $psize, 'tempDir'=>'/www/htdocs/xxx/osticket/tmp/']);
            $this->_print();
    	}
    Write a Reply...