1

I'm setting up laravel-snappy to create pdf.

My snappy config is as below

<?php
return array(
'pdf' => array(
        'enabled' => true,
        'binary' => base_path('vendor/h4cc/wkhtmltopdf/bin/wkhtmltopdf'),
...

By running config('snappy') inside tinker, I also get the exact required path that is within the laravel project folder

But I'm getting the following error

local.ERROR: is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s):

How can I solve this without changing the php settings?

4

1 回答 1

0

似乎该包试图写入该/tmp文件夹,但受到 PHPs ini 选项的限制open_basedir

storage/tmp您可以使用该方法将此文件夹路径更改为应用程序中的某些内容,也许是setTemporaryFolder().

$pdf = App::make('snappy.pdf.wrapper');
$pdf->setTemporaryFolder(storage_path('tmp'));
// ...
于 2019-05-09T13:20:19.413 回答