In an ideal world, your website works perfectly fine without any issues. But the reality is very different. Errors are inevitable and they are a regular part of the application lifecycle. Unless you have a completely static HTML website without a single line of PHP, sooner or later some sort of error will arise on your website and it will not be your fault.
“Errors are inevitable and they are a regular part of the application lifecycle.”
There are different types of errors that can be caused by a number of reasons. In this article we cover fatal errors – errors that completely crash a website.
Think about a website as a bunch of black boxes connected to each other with an unlimited number of wires. Each box performs some sort of task upon request and some boxes are dependent on other boxes to provide additional information. There are also exceptional boxes with “anger issues” and they simply halt the entire website when you do not provide them with what they need. There can be hundreds or even thousands of boxes on a website and it is only a matter of time when one of those boxes will fail with a fatal error either because a depending box is missing or invalid data was provided.
Below you will find some of the most common reported fatal errors that crash websites. You can check out the relevant help article and try to fix them or install the CodePinch plugin and we will fix it for you.
1. Call to Undefined Function
This is a very serious issue. Something is horribly wrong and requires a level of code debugging to find the root cause of the error. There are two possible reasons: the first reason is that a file which contains the calling function was not included in the application executable scope. Reason two: the calling function belonging to the PHP core is not included in your current PHP version or a PHP library containing this function is not active.
While the first reason would require you to dive deep into your website source code, the second reason can be clarified by simply searching the calling function on the php.net website. Copy & paste the function name into the search field on the php.net website and if it is a part of the PHP core, it will give you a positive result. From here you can find out what PHP version you need to have or what library is missing on your server.
To read how to fix the call to undefined function error manually, check this help article or install the CodePinch plugin and we will fix it for you.
2. Class Not Found
This error is very similar to call to undefined function because it is a clear indicator that a calling class is missing and again this would require a similar approach to resolving the error.
Check how to fix the class not found error manually in this help article or install the CodePinch plugin and we will fix it for you.
Exceptions are a programmatic way to halt website execution and unfortunately are not used properly by all developers. The developer may assume you know how to fix the problem based on the exception’s message. However, in many cases the error results in a blank page without any ability to read that message.
Fortunately, the CodePinch plugin has an elegant way to deal with exceptions so you can always know what caused it and based on the provided message, resolved the problem.
4. Out of Memory
Out of memory or allowed memory size exhausted is a very common error when your website is trying to process a batch of data that requires an allocation of more memory than your server allows. This is a PHP configuration error and you can read this article to learn how to fix it.
5. Maximum Execution Time Exceeded
The maximum execution time is another common error for large websites and is triggered when some internal PHP routines take more time to process data than is allowed in the PHP configuration. You can find more information on this error and how to fix it in this article.
Please note! This may be a very occasional error, but do not ignore it. Eventually, when your website accumulates more data the error may appear more regularly. You should fix it ASAP or contact our expert team and we will help you.
6. Call to Undefined Method
Method is very similar to function, with the difference being that a method belongs to some object. Think about object as collection of functions and properties that work together to do some specific task within your website.
To learn how to fix call to undefined method error manually, check this help article or install the CodePinch plugin and we will fix it for you.
7. Required File Failed to Open Stream
Your website is a collection of files serving different purposes. During website execution, web servers require numerous files upon request. Sometimes it requires the same file multiple times. It is very common to experience this fatal error when there are many dependencies and some files were recently updated or deleted.
In most cases the only solution is to consult with a developer or restore the website from backup. However, you can install the CodePinch plugin and we will take care of this issue for you.
8. Cannot use object as array
Based on the thousands of reported errors to our server, one of the most common reasons for this error is the website input data contains unexpected values. For example, if a remote request to third party services like Twitter or Facebook are not completed successfully the response will be a WP_Error object instead of a nicely formatted array of data.
Typically, this is an occasional error and does not happen often. However, it is very important to address this issue ASAP. Check this help article to learn more on how to fix this error.
9. Cannot declare class, because the name is already in use
When your website has multiple third party dependencies like plugins, extensions or themes, it is hard to avoid this fatal error. Sometimes two or more plugins may declare a class with the same name. When your website loads a page that utilizes both plugins the error will occur.
There is no easy way to fix this error, as it requires in-depth website investigation. However, there is a way to avoid declaring the same class twice by wrapping each class declaration in an IF statement. To learn how to do this, check out this help article.
Website errors are inevitable. No matter how great your website’s code is, there is always a lingering bug. The industry average is 15-20 bugs every 1,000 lines of code. For context, WordPress has approximately 484,000 lines of code not including the hundreds of thousands of third party plugins and themes. There is absolutely no way to keep your website completely error free without constant error monitoring and fixing.