mikehaertl/php-pdftk

PHP 8 and No Ouput Created

Closed this issue · 4 comments

Hello

I installed the latest version of php-pdftk on a Mageia Linux 8 server with PHP 8.0.30 and I get the following message : "Error: Unable to find file. Error: Failed to open input PDF file: form.pdf Errors encountered. No output created. Done. Input errors, so no output created."

This is my (simple) code

<?
require("/usr/local/bin/vendor/autoload.php");

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('form.pdf');

if (!$pdf->saveAs(date("Ymd_His")."_output.pdf")) {	$error = $pdf->getError(); var_dump($error); }
?>

If I test on an old server where I used to use an old version of php-pdftk (Linux 5 and PHP 5.6.36), this script works perfectly. I checked access to the temporary folder and no problem, the temporary file (empty) is created then deleted. How do I know where the problem is coming from on this new server...?

Error: Unable to find file.

You should probably supply the full path to your file, not just form.pdf.

Thank you very much for this response. It works with the absolute path.
I have many scripts that work with an old version of php-pdftk using relative paths. That's why I used relative paths.

And using these scripts and this old version on my new server, it no longer works.
With identical scripts and identical php-pdf-pdftk library it no longer works.

The difference is related to pdftk...?
In version 2.02 on old server and "port to java 3.2.1" on new server....?

Compare the output of <?php phpinfo(); ?> on both servers. Probably some server configuration has changed. But that's beyond the scope of our library.

Regarding pdftk versions: Yes, there may be differences in the syntax. I can not provide any assistance here, sorry. You should study the differences in pdftk -H on the command line. And also play around with your code (e.g. comment out some parts/options) until you find the offending setting.

Again, please understand that I can not provide support when it comes to debugging local setup issues.

Yes, I completely understand that you are not here to provide assistance in debugging local configuration issues.
I asked the question to understand and your answers are more than enough, it's up to me to see from now on.

Thank you again for the time you gave me and your answers.