PHP Errors and Exceptions
On this page
WHMCS may return PHP errors and exceptions if errors occur. Errors may be informative or can indicate a critical issue. Exceptions stop the current routing and return control to the previous invocation so that the system can use an appropriate, alternative code.
PHP Errors
PHP errors can vary from informative to critical. For example:
- The insensitive
E_ERROR
andE_PARSE
types indicate that there is a critical problem interpreting the code. - The hyper-sensitive
E_STRICT
type indicates that there’s a code instruction that may trigger ancillary contexts that the developer should note for cross-compatibility against PHP versions or incorporated libraries. However, it does not indicate an error.
Depending on the error type, it may be possible to suppress the error and continue the current code path. For critical errors types like E_ERROR
and E_PARSE
, it is not possible continue the current code path since it explicitly represents non-functional code and there is no viable alternative path available.
Exceptions
Ideally, all code that emits an exception will have surrounding code that can observe the exceptional condition and take a valid, user-friendly path. If this is not possible, then PHP will continue to revert control, all the way back to the originally-called script. If the original script cannot observe the exception, it becomes an uncaught exception and will behave like a critical error.
Handlers
If the system invokes an uncaught exception or error condition (based on the error reporting level), PHP will attempt to execute any registered handlers that PHP defined before the condition occurred. The handlers provide a last minute opportunity to affect how to report the condition. They do not have the power to mitigate the condition or revert to an alternative code path.
WHMCS registers various error and exception handlers as soon as possible so that if such a condition occurs, there’s a final opportunity to output a friendly message. If the condition happens before WHMCS has the opportunity to register its handlers, such as missing or corrupt core files or an invalid environment, the result will be the behavior that the server defines (for example, php.ini
file and Apache® settings).
Common PHP Errors
You may see the following common PHP errors:
Error | Description | Recommended Solution |
---|---|---|
500 Internal Server Error | This error indicates that there was a problem while processing a request. Usually, this is due to an issue with a customization or in your PHP configuration. | Add $display_errors = true; to your configuration.php file or review the PHP error_log file to determine the exact error. If the error is due to a third-party module or customization, remove the custom files and confirm whether this resolves the error.For more information on updating this file, see The configuration.php File. |
PHP Fatal error: Maximum execution time of 300 seconds exceeded in /path/to/file.php | The max_execution_time limit is too low for a specific task or operation. By default, WHMCS enforces a max_execution_time limit of 300 seconds for general requests. | Increase the max_execution_time limit by adding the following new line to your configuration.php file:$overidephptimelimit = 500; For more information on updating this file, see The configuration.php File. |
Last modified: November 12, 2024