EKBG
EKBG

Reputation: 253

FPDF Error, Fatal error: Maximum function nesting level of '100' reached, aborting

I tried to execute below php file to create fpdf reports.

<?php
require('reportspdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times','I',16);
$pdf->Cell(0,10,'Yay TutToaster Rocks !!',0,1,'C');
$pdf->Output();
?>

And the error comes as "Fatal error: Maximum function nesting level of '100' reached, aborting! ".

I added "xdebug.max_nesting_level=500" (I tried 200, -1 as well) line after "[xdebug]" on php.ini file, and restarted all services in WAMP server. But nothing solved the error. When trying larger number like "1000" page keep loading. Then did comment the zend extension path.

It occured an error "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1792 bytes) in D:\wamp\www\Pharmacy Management System\pages\reportspdf.php on line 2".

Please help me to get rid of this.

Upvotes: 1

Views: 340

Answers (1)

Ben Hillier
Ben Hillier

Reputation: 2104

I strongly suspect the issue is that 'reportspdf.php' keeps calling require on itself. That means it keeps trying to load itself. Try replacing line 2 with:

require_once('reportspdf.php'); 

And if the name of the PHP file you pasted is reportspdf.php, then try removing line 2 altogether.

Upvotes: 1

Related Questions