System Status
Buy Now
  • Email & Apps
  • Office 365
Login
  • MyRackspace Portal
  • Cloud Control Panel
  • Rackspace Webmail Login
  • Cloud Office Control Panel
  • Support Home
  • How-To
  • Developer Documentation
  •  Blogs 
    • Expert Insights Tech Blog
    • Rackspace Blog
    • Solve: Thought Leadership

Support Network

End-to-End Multicloud Solutions.   Solving Together.â„¢   Learn more at Rackspace.com

How–To Home

Cloud Servers

  • Introduction
  • FAQ
  • All Articles

PHP Errors

Last updated on:  2021-08-13

Authored by:  Alfonso Murillo


PHP Errors

This article shows how to obtain detailed information about PHP errors. As PHP is one day-to-day tool for many developers, the following suggestions are useful for being able to work more efficiently through identifying errors faster.

Display errors

To display errors you need to enable error display in the php.ini file. Open the file and identify the display_errors and the error_reporting directives.

The error_reporting directive uses an integer value to define the error reporting level. For a list of constants for this directive and the errors they present refer to the PHP official documentation for error predefined constants.

In case you do not want the error_reporting value changed for all files you can set it at runtime with the error_reporting() function.

The display_errors directive determines whether errors should be printed to the screen as an output or if they should be hidden from the user. The value stderr makes the error go to stderr instead of stdout.

In the php.ini file you would see something like this:

php_flag  display_errors        on
php_value error_reporting       2039

Although you can also set them at runtime with something like the following:

error_reporting(2039);
ini_set('display_errors', 'On');

For errors that happened during the startup sequence of PHP, you should activate the display_startup_errors directive, since this type of error does not show with display_errors only. On runtime you can set it with: ini_set('display_startup_errors', 1);

For more errors configuration options you can go to the PHP documentation for a complete list by clicking here.

Conclusions

Displaying PHP errors help to solve problems faster by obtaining descriptive information based on the configuration you placed. Please note that the outputs must be hidden before placing your site into production to avoid customers seeing the error logs.

Share this information:

©2020 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER

About Rackspace
  • About
  • Customer Stories
  • Events
  • Programs
Blogs
  • The Rackspace Blog
  • Expert Insights Tech Blog
  • Solve: Thought Leadership
  • News
  • Contact Information
  • Legal
  • Careers
Site Information
  • Style Guide for Technical Content
  • Trademarks
  • Privacy Statement
  • Website Terms
Support Network
  • Support Network Home
  • Rackspace How-To
  • API Documentation
  • Developer Center
  • ©2020 Rackspace US, Inc.