We upgraded our laravel from version < 8 to version 8 and also upgraded the php from 7.1 to php 7.4
Now there are some functionalities that got depreciated such as maatwebsite and also the Fpdi. We managed to upgrade the code of maatwebsite to latest but currently we just figured it out that the functionality of Fpdi is not working.
I tried the solutions that I have found but unfortunately it did not or am I missing something?
1st solution
<?php
// I added this line of codes before, inside and after of calling the object Fpdi(); but it didn't work
// Check if magic_quotes_runtime is active
if(get_magic_quotes_runtime())
{
// Deactivate
set_magic_quotes_runtime(false);
}
?>
2nd solution
Where should I added this line of codes?
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
}
Question: How do I fix this issue?
Code
$pdf = new Fpdi();
$page_count = $pdf->setSourceFile(public_path()."/form/form.pdf");
for ($pageNo = 1; $pageNo <= $page_count; $pageNo++) {
}
It appears you’re using FPDI v1 which is not only deprecated, but has not received updates in nearly 6 years.
There is a version 2 which is available without deprecated code.
It is not a plug and play replacement and will require changes to your code so follow the instructions on the website to see what lines of code you use need to be updated. Among other namespace itself has been updated.
https://github.com/Setasign/FPDI
On a related note, be aware that PHP 7.4 has reached end of life, as has Laravel 8.