Hi,

When my php pages are not working all i get is a blank page. Surely I should be able to see some sort of error message pointing to me to which line of my code is incorrect. Please help as this is so frustrating - I can't work out where problems are occurring!

Thanks in advance,
Natalie

    In php.ini set display_errors to On and error_reporting to E_ALL

      I have changed display_errors to On. Error_reporting was already set to E_all. I still get a blank page. Is there anything else it could be?

        Can you do two things for us.

        1. Post some code that isn't working.
        2. Tell us which version of PHP you are using.

        I've found some strange things with PHP 5, but generally in my experience a blank page is due to code that works OK but because a variable is detected as blank or an exit() is in the wrong place there is nothing to display.

        Blu

          E_ALL, not E_all

          What is the script that you tested with? I suggest something simple like:

          <?php + ?>

            This is the code - it is out of a book i'm using as i'm trying to learn how to create pdfs on the fly. I've got my system administrator to install pdflib

            <?php
            //create a pdf document in memory
            $pdf = pdf_new();
            pdf_open_file($pdf, '');

            pdf_set_info($pdf, "Creator", "pdftest.php");
            pdf_set_info($pdf, "Author", "Luke Welling and Laura Thomson");
            pdf_set_info($pdf, "Title", "Hello World");

            pdf_begin_page($pdf, 8.572, 1172);

            //add a bookmark
            pdf_add_bookmark($pdf, 'Page 1', 0, 0);

            $font = pdf_findfont($pdf, 'Times-Roman', 'host', 0);
            pdf_set_font($pdf, $font, 24);
            pdf_set_text($pdf, 50, 700);

            //write text
            pdf_show($pdf, 'Hello, world!');
            pdf_continue_text($pdf, '(says PHP)');

            //end the document
            pdf_end_page($pdf);
            pdf_close($pdf);

            $data = pdf_get_buffer($pdf);

            //generate headers
            header('Content-Type: application/pdf');
            header('Content-Disposition: inline; filename=tet.pdf');
            header('Content-Length: ' . strlen($data));

            //output pdf
            echo $data;
            ?>

              Unless you are able to determine the error message, we cannot help you. You should have display_errors = On (or log_errors = On and know where the log file is) and error_reporting = E_ALL in php.ini.

              Mark

                Write a Reply...