• Hi there

    I have been using this wonderful script for a number of years, actually with no problem to insert some 2, 3 php scripts in some pages to pull some content from external sites.
    I have just noted the pages with it have the error message
    “There has been a critical error on this website.”
    and almost all the page content does not load, with a skeleton of the theme and upper menu and in some cases just the WordPress error text on a white page, no theme loaded. All other site pages, as you will note load normally, including those generated by some plugins, which is probably in case the problem has been there for long why I did not notice it. I have no idea what could be triggering it.

    I have WordPress and all plugins always automatically updated and so everything is. Theme: Spacious. I tried other themes, twentythirteen & fifteen, but it made no difference.

    In the Plugin settings, if I preview any of the snippets, such as:

    <?php
    include($_SERVER['DOCUMENT_ROOT']."/giveaway/single.php");

    I get the same error “There has been a critical error on this website.

    What could be causing this? Actually some of the sites most visited pages have this script and so I request you to help me solve the problem as soon as possible, for which I would be very grateful.

    Kind regards

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • The “There has been a critical error on this website” message in WordPress typically indicates a fatal PHP error that has occurred on your website.
    So there might be an issue with the code used in snippet.
    When this error occurs, WordPress automatically disables the theme and plugins causing the error to prevent further damage to your site. To diagnose and fix this issue, follow these steps:

    1. Access the Error Log:
      • If you have access to your website’s error logs (usually available in your hosting control panel or via FTP), check for specific error messages related to the critical error. Look for files and lines where the errors are occurring.
    2. Debug Mode:
      • Enable WordPress debugging by editing your wp-config.php file. Add the following lines:phpCopy codedefine('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
      • This will log PHP errors to a debug.log file in the /wp-content/ directory without displaying them on the site. Check this log for more detailed error messages.
    3. Check PHP Syntax:
      • Review the PHP code in the scripts you’ve added to your pages. Make sure there are no syntax errors or missing semicolons, brackets, or quotes. A simple syntax error can lead to a critical error.
    4. Incompatible or Deprecated Functions:
      • Check if any functions or features used in your PHP scripts are deprecated or no longer supported in newer PHP versions. If so, you may need to update your code accordingly.
    5. Plugin/Theme Conflicts:
      • Temporarily disable all plugins and switch to a default WordPress theme (e.g., Twenty Twenty-One). Then, reactivate them one by one to identify if a specific plugin or theme is causing the issue.
    6. Memory Limit:
      • Check your website’s PHP memory limit. If your scripts are consuming too much memory, it can lead to critical errors. You can increase the memory limit by editing the wp-config.php file:phpCopy codedefine('WP_MEMORY_LIMIT', '256M');
    7. Security Considerations:
      • Make sure that the external content you are pulling into your site is secure and not causing security vulnerabilities.
    8. File Inclusion Security:
      • Be cautious with using include() or require() to include external files. Ensure that you are not including files from untrusted sources or using user input directly in file paths.
    9. Check for Updates:
      • Ensure that any external content or APIs you are using are still compatible with your code and haven’t changed their endpoints or authentication methods.
    10. Server Environment:
      • Check with your hosting provider to ensure that there haven’t been any server environment changes that might be affecting your scripts.

    By following these steps and pinpointing the exact cause of the critical error, you can work towards resolving the issue and getting your site back to normal. If you encounter specific error messages in your logs, feel free to share them here for further assistance.

    REFERENCE : https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-critical-error-in-wordpress/

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘There has been a critical error on this website.’ is closed to new replies.