mikehaertl / php-pdftk

A PDF conversion and form utility based on pdftk
MIT License
939 stars 124 forks source link

SaveAs issue #314

Closed MindBreak11 closed 11 months ago

MindBreak11 commented 12 months ago

I am working on my school project and used pdftk in it. For some reason the whole pdftk function works perfectly fine in my local XAMPP server but when I run it in InfinityFree web server it gives me this strange error.

Fatal error: Uncaught Error: Call to undefined function mikehaertl\shellcommand\escapeshellarg() in /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-shellcommand/src/Command.php:293 Stack trace: #0 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-pdftk/src/Command.php(191): mikehaertl\shellcommand\Command->addArg('A=', './imm547e.pdf') #1 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-pdftk/src/Command.php(178): mikehaertl\pdftk\Command->processInputFiles() #2 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-pdftk/src/Pdf.php(715): mikehaertl\pdftk\Command->execute('/tmp/tmp_php_pd...') #3 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-pdftk/src/Pdf.php(616): mikehaertl\pdftk\Pdf->execute() #4 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/Classes/PopulatePDF.php(15): mikehaertl\pdftk\Pdf->saveAs('./completed/mav...') #5 /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/Docu.php(806): Classes\PopulatePDF->populate(Array, 'mavric') #6 {main} thrown in /home/vol8_5/infinityfree.com/if0_35010896/htdocs/Forms/vendor/mikehaertl/php-shellcommand/src/Command.php on line 293

I really would appreciate the help as I am having a really hard time fixing this problem

mikehaertl commented 12 months ago

Sorry, I can not really help you much: It looks like a restriction at your hoster: It seems to block calls to the builtin PHP method escapeshellarg().

https://www.php.net/manual/en/function.escapeshellarg

My guess is, that it has some security restrictions which don't allow you to call any shell commands at all. In this case you're out of luck. Our library does not work then.

You should contact their support and ask for help.

mikehaertl commented 11 months ago

Closing this as there was no further feedback and the error message indicates that it's not an issue we can fix in the library.