使用 MPDF 7 美分

Using MPDF Centos 7

求助!!!!我在 centos 7 中安装了带有 composer 的 MPDF 以打印 pdf,但它向我显示了这个错误,但如果我在 localhost (xampp) 中使用 mpdf 则效果很好。

这是日志错误

[Thu Sep 20 13:54:37.030998 2018]
[php7:error] 
[pid 27057] 
[client 190.85.133.241:60785] 
PHP Fatal error:  Uncaught Mpdf\MpdfException: Temporary files directory 


"/var/www/html/pitah/vendor/mpdf/mpdf/src/Config/../../tmp" 
is not writable in /var/www/html/pitah/vendor/mpdf/mpdf/src/Cache.php:17

\nStack trace:\n#0 /var/www/html/pitah/vendor/mpdf/mpdf/src/Mpdf.php(983): Mpdf\Cache->_construct('/var/www/html/p...')\n#1 

/var/www/html/pitah/pdf.php(183): Mpdf\Mpdf->_construct(Array)\n#2 {main}\n  thrown in /var/www/html/pitah/vendor/mpdf/mpdf/src/Cache.php on line 17,

referer: http://pitah.com.co/login/index.php

这是我的 mpdf 配置

<?php

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf(                         
                        'mode' => 'utf-8',
                        'format' => 'A4',
                        'orientation' => 'L',
                        'default_font' => 'mycustomfont',
                        'margin_left' => 15,
                        'margin_right' => 10,
                        'margin_top' => 16,
                        'margin_bottom' => 10,
                        'margin_header' => 10,
                        'margin_footer' => 10
    ]);
$mpdf->allow_charset_conversion=true;
$mpdf->charset_in='UTF-8';

已经修复,这是 SElinux 的问题,我使用了这个:https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/