March 27, 2023 • For devs

PHP Bug Tracking

PHP Bug Tracking

We're Streply, a tool that tracks errors and manages logs quickly. It's easy to set up and compatible with many popular frameworks. Made by developers, for developers! If you need to keep an eye on errors and follow logs in your app, create free account.


When creating, developing and supporting an PHP apps, it is important to think about bug tracking and analysis well before the first line of code is written. PHP bug tracking brings benefits on two levels:

  • Improves programming workflow, shows more error data than the default error handling in PHP
  • Enables you to track errors that occur among clients or in background tasks

It is impossible to develop good and secure software in PHP without a professional approach to error handling.

How to show errors in PHP?

To enable the display of errors on the screen, it is necessary to add the below code to the main file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

However, this is not a good solution. Firstly, showing errors can be activated solely in development or local versions. You should never show errors in applications to which users have access. Not only does this not look professional, but it also creates a very high risk for the application. The person with technical knowledge will be able to analyse the structure of the application on the basis of the information from the errors, which may enable a loophole to be found.

How to track errors in PHP?

There are several methods available for tracking errors, but we will focus on the three essential ones. Saving errors to files, to a database and using tools like Streply that collect and save information to an external database. In this article, I will present 3 ways to handle errors in PHP and the pros and cons of these solutions.

PHP error log to files

By default PHP saves errors and logs in files. We won't cover the advantages of this solution, because there is really only one: it is the fastest to implement. It is the technologically easiest solution, but unfortunately the least convenient. Searching through dozens of large files is very inefficient and finding the bug you are looking for in the files, or extracting something specific from this information, is very difficult. Another benefit is that the logs can be easily transferred, you just copy the files or the whole folder and you are done.

PHP error log to database

Another option, more convenient for analysis and review, is to save errors and logs in a database. Reviewing, searching or sorting logs in the database is much more convenient and offers the developer many more options. The downside, unfortunately, a very serious one, of such a solution is that in the event of certain types of failure, access to the database may not be available. This will make it harder, or in extreme cases even impossible, to find and fix the problem.

PHP error tracking

The last solution we will discuss in this article is to use an external service that will send a request with all available error information via an API.

This solution has several advantages:

  1. Errors and logs are collected in an external database, completely independent of the application. A failure of the application or server will not hinder, let alone prevent, access to the logs.
  2. Applications of this kind have a number of useful functions and capabilities that would take a very long time to program on one's own.
  3. In addition to simply collecting or analysing errors, these types of applications offer very useful options, such as email or messenger notifications when an error matching certain criteria occurs.

The drawback of such a solution is that in very rare situations, e.g. a failure on the server, a request with an error may not be sent. However, fortunately, there are measures to prevent such situations.

As you can clearly see, there are many possibilities. I have only mentioned the most popular and best ones in this article. Judging objectively, the best form when it comes to tracking errors in PHP applications is to use an external service. Not only does this increase security in the event of a malfunction, as we are certain to have access to the logs, but we also get access to a number of functions that would have taken weeks to program on our own.

Sign up for an account with Streply and see what benefits our application offers.

Ready to fix your code?



Crash Reporting

Try for free
We are not pushy
We only send a few emails every month. That's all.
No spam
We only send articles, and helpful tips for developers, not SPAM.