Science, Tech, Math › Computer Science How to Turn on PHP Error Reporting A Good First Step to Solving Any PHP Problem Share Flipboard Email Print Ryan Lees/Getty Images Computer Science PHP Programming Tutorials MySQL Commands Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Angela Bradley Angela Bradley Computer Science Expert B.A, History, Eastern Oregon University Angela Bradley is a web designer and programming expert with over 15 years of experience. An expert in iOS software design and development, she specializes in building technical hybrid platforms. Learn about our Editorial Process Updated on December 26, 2018 If you are running into a blank or white page or some other PHP error, but you have no clue what is wrong, you should consider turning on PHP error reporting. This gives you some indication of where or what the problem is, and it is a good first step to solving any PHP problem. You use the error_reporting function to turn on error reporting for a specific file that you want to receive errors on, or you can enable error reporting for all your files at your web server by editing the php.ini file. This saves you the agony of going over thousands of lines of code looking for an error. Error_reporting Function The error_reporting() function establishes the error reporting criteria at runtime. Because PHP has several levels of reportable errors, this function sets the desired level for the duration of your script. Include the function early in the script, usually immediately after the opening <?php. You have several choices, some of which are illustrated below: How to Display Errors Display_error determines whether errors are printed on the screen or hidden from the user. It is used in conjunction with the error_reporting function as shown in the example below: Changing the php.ini File at the Website To see all error reports for all your files, go to your web server and access the php.ini file for your website. Add the following option: The php.ini file is the default configuration file for running applications that use PHP. By placing this option in the php.ini file, you are requesting error messages for all your PHP scripts. Cite this Article Format mla apa chicago Your Citation Bradley, Angela. "How to Turn on PHP Error Reporting." ThoughtCo, Aug. 27, 2020, thoughtco.com/php-error-reporting-2694206. Bradley, Angela. (2020, August 27). How to Turn on PHP Error Reporting. Retrieved from https://www.thoughtco.com/php-error-reporting-2694206 Bradley, Angela. "How to Turn on PHP Error Reporting." ThoughtCo. https://www.thoughtco.com/php-error-reporting-2694206 (accessed June 2, 2023). copy citation Featured Video