A perfect storm starts from a breeze – website crashes can happen even after minor errors.
Do not underestimate the importance of any PHP errors your website triggers, they’re a clear sign something’s not working as intended. Sometimes they cause a bad user experience, data corruption, and failure to complete important tasks. Errors are one of the top sources for information about your website, so they can even lead to website hacking. Below we list 5 common errors that will most certainly have negative consequences which should be addressed as soon as possible.
Cannot modify header information – headers already sent by
Very often this error is completely ignored by website owners as it seems like it does not do much damage except occasionally break the page layout but the true consequence is much more harmful. When you see this error, it means your website was trying to send a user some very important information. Headers are the way for the website server to communicate with a user’s browser and if this channel is broken, then it is guaranteed that user will be not able to work with your website properly.
This error will not crash a website but has a significant impact on the user experience. The error means your website was not able to establish a session with the user. Sessions are used to keep important information about a user on the server. If it is not established successfully, your website will be not able to handle user requests and in some cases, completely refuse to work for a user.
mysql_connect(): MySQL server has gone away
mysql_connect or any mysql_*, mysqli_* function that fails means something either was not stored to or retrieved from the database. It typically causes many more errors because the code is not able to work properly with the database. It may try to execute with undefined data and that has unpredictable outcomes. Make sure you keep an eye on the database related errors.
file_get_contents(): failed to open stream: No such file or directory
It is very common practice for a website to manipulate files on the server in order to read or write some information for later use. When website code fails to write or read information from the file, it starts causing very unexpected issues. This is why you should always address any PHP errors related to file_* functions (e.g file_get_contents, file_put_contents, fopen, fclose etc).
Maximum execution time of 30 seconds exceeded
This is probably one of the most frustrating errors because many times it forces a user to wait at least 30 seconds just to show that the website was not able to complete a task. When your website experiences this type of error, it typically means the website is trying to process or request a lot of data and it fails to do this job within the time limit defined by the server settings. The default timeout is 30 seconds, however, it can be easily changed in the PHP configuration file.
Always keep an eye on PHP errors because they are clear indicator that something is not working as expected. Even if some errors only appear occasionally, do not ignore them. The longer your website is running, the greater chance that those errors will become regular.
Looking for extra help? Download CodePinch for a free fix.