Skip to main content

How to Troubleshoot a PHP Fatal Error

A PHP Fatal Error occurs when a script encounters a critical problem that prevents it from continuing execution, resulting in a blank page or a specific error message. This guide helps you identify the cause of a Fatal Error on your website and...

Before you begin

You will need:

  • Access to your website's hosting control panel (such as cPanel or Windows Control Panel).

  • Access to the file manager or an FTP client.

  • The specific URL where the error is occurring.

Identify the error source

To resolve a Fatal Error, you must first determine the specific reason the script failed.

  1. Access your hosting control panel.

  2. Locate your website's error logs.

    • In cPanel, go to the Metrics section and select Errors.

    • In Windows Control Panel, locate the Error Log for your specific website or application pool.

  3. Identify the most recent entries related to your website's URL.

  4. Look for the specific PHP error message and the file path provided in the log.

Note: A "Fatal Error" often includes a specific file path and line number (e.g., /home/user/public_html/wp-content/plugins/plugin-name/file.php on line 123). This information is critical for pinpointing the faulty code.

Common causes and resolutions

Depending on the error message found in your logs, follow the relevant troubleshooting steps below.

"Allowed memory size exhausted"

This error occurs when a script requires more memory than the current PHP configuration allows.

  1. Identify the script causing the error from the logs.

  2. Increase the memory limit in your hosting control panel.

    • In cPanel, go to Select PHP Version > Options and increase the memory_limit.

    • In Windows Control Panel, adjust the memory_limit in the php.ini file.

  3. Test the website to see if the error persists.

"Maximum execution time exceeded"

This error occurs when a script takes longer to run than the time limit allowed by the server.

  1. Identify the script causing the error from the logs.

  2. Increase the execution time limit.

    • In cPanel, go to Select PHP Version > Options and increase the max_execution_time.

    • In Windows Control Panel, adjust the max_execution_time in the php.ini file.

  3. Test the website to see if the error persists.

"Call to undefined function"

This error usually means a required PHP extension is missing or a function is not available in your current PHP version.

  1. Check the log to see which function is missing.

  2. Verify if the required PHP extension is enabled in your control panel.

  3. If the error persists, contact Hostek support to confirm if the specific extension is available for your account.

Plugin or Theme conflicts (WordPress)

If the error occurs specifically after installing or updating a plugin or theme, that component is likely the cause.

  1. Access your site's files via a File Manager or FTP.

  2. Navigate to wp-content/plugins/.

  3. Rename the folder of the suspected plugin (e.g., rename plugin-name to plugin-name_old).

  4. Refresh your website. If the site loads, the plugin is the cause.

  5. Repeat this process for themes if a plugin is not the cause.

Confirm the result

  • The website loads successfully at the URL where the error was previously occurring.

  • The error logs no longer show "Fatal Error" entries for that specific page.

If the error persists after these steps

If you have identified the specific file and line number but cannot resolve the issue by adjusting PHP limits or disabling plugins, the issue may be a bug in the application's code.

Collect the following information before contacting Hostek support:

  • The full error message from your logs (including the file path and line number).

  • The specific URL where the error occurs.

  • A description of what you were doing when the error appeared (e.g., "I just updated a plugin" or "I just changed a setting").

Did this answer your question?