Hi everyone.
When I deployed my site I got this error: Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file (output started at /srv/disk6/blablasite/rel_funcionario.php:1).
I'm using fpdf v. 1.81 and I am developing in PHP (using XAMPP and Notepad ++), in that platform itworks just fine, but when I uploaded it gave that fatal error.
In the page funcionario.php I show de elements regardind the user (after query on the DB), and if the user wants to print/convert to PDF presses a link

<p><?php echo "<a href=\"./?p=rel_funcionario&func=" . urlencode($nav_links['id_funcionario']). "\" target=\"_blank\">IMPRIMIR RELATORIO</a>"; ?> </p>

In the rel_funcionario.php I get the element func and process the PDF:

<?php
    require ("fpdf/fpdf.php");

    if (isset($_GET['func'])){
        $func_selc = $_GET['func'];
    } else{
        redireciona("./?p=funcionarios");
    }

    $nav_links = obtem_func_id ($func_selc);

    $pdf=new FPDF('P','cm','A4');
    $pdf->AddPage();
    $pdf->SetTitle("blabla");
    $pdf->SetAuthor("blabla");
    $pdf->SetSubject('blabla');
    $pdf->SetFont('Arial','BI',12);
    ...
    $pdf->Cell(0,1,$nav_links['obs'],1,1);
    $pdf->ln();

    $pdf->Output();
?>

I know that I cant send HTML or any spaces (I've looked and checked) but I can't find the problem.

Can anyone help me?

If line 7 is a header(); redirect, then place an exit(); after it. Might be the cause.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.