6/2/2023 0 Comments Zend studio 10 xdebugIt’s one thing to log errors-that’s almost a given. It’s a whole other thing to take action when errors are logged. But even with the best logging settings, you still need to monitor for errors. The PHP manual spells out these settings in more detail and provides more information I could ever fit in this section. Do this in production rather than displaying them to end users. log_errors and error_log work together to send errors to a log file. display_startup_errors should only be used when debugging.display_errors tells PHP if and where to display error messages.E_NOTICE is useful during development since it will tell you about defects such as unassigned variables. error_reporting sets the level of logging.You’ll want to consider the following settings: This is possible, but think about how you would change modes after deploying your application.Ī combination of settings will get you the right levels of error logging. If you can’t use configuration files, you have the option of changing the values via a script. Otherwise, you might use the htaccess configuration. You can use the php.ini file, if you have access to it. PHP has a few ways to configure error reporting. Each function has a purpose and can be useful for debugging. You can see them in action in this Paiza. These functions are a quick way to debug your PHP code. Here’s sample code that exercises each of these useful debugging functions: You can print_r, log it to a file, or send it to a logging endpoint asynchronously.
0 Comments
Leave a Reply. |