Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Server 500 error in browser. How to fix


On this page

    If you’re seeing a server 500 error message in your browser, it’s often caused by memory issues. This is easily fixed using the Staq Panel.

    Step 1: Confirm Memory Issues

    To verify if this is a memory-related issue, go to the Staq Panel for the site in question. Under the Advanced section, click on Debug.

    1. Click Enable Debug at the top right of the Debug page.
    2. After enabling, click Refresh to load the latest logs.
    3. Review the logs under the WordPress tab:

    If you see a PHP Fatal error message, especially one like this:

    PHP Fatal error: Allowed memory size of ### exhausted

    you can view additional logs if memory has been increasing over time or follow this guide to increase your server memory for WordPress.

    Analyzing Memory Usage and Errors

    Sometimes, memory spikes are caused by specific plugins, themes, or unexpected changes. Here’s a real-life example:

    Ticket Summary:

    A site was maxing out memory resources, causing 500 errors. Bumping the memory to 512MB restored the site, but the client wanted to know if this was legitimate usage or if there was an underlying cause.

    Resolution Steps:

    1. The memory was brought back down to 256MB to replicate the error. Logs revealed the site only needed an extra 4MB of memory to process a request, but since it hit the ceiling, it caused the 500 error.
    2. The following steps were taken to address the issue:
      • Replaced WP Rocket with Staq Cache, which significantly reduced memory usage while retaining performance.
      • Enabled Redis Object Cache, further optimizing memory usage.
      • Suggested reviewing unneeded plugins.
    3. A deeper analysis revealed a spike in memory usage starting on December 1st, correlating with updates to certain plugins and themes.
      • Using the Reports > Plugin & Theme Updates section in Staq, several plugins updated on December 1st were identified.
      • Debug logs also pointed to the Astra theme as a potential culprit, which had a known issue causing increased memory usage. Updating the theme manually resolved the issue.

    Key Takeaway: Even a minor memory increase (4MB in this case) can prevent crashes. If the site’s monthly fees justify higher memory requirements, consider increasing the memory allocation permanently.

    Considerations Before Increasing Memory

    Before upgrading memory (which will incur additional costs), try the following optimizations to see if they resolve the issue:

    1. Enable Redis Object Caching:
      Follow our guide on enabling Redis Object Caching to reduce database load and improve memory efficiency.
    2. Switch to Staq Cache:
      If using third-party caching plugins like WP Rocket, consider replacing them with Staq Cache, which is optimized for our platform and reduces memory usage.
    3. Debugging Plugins/Themes:
      Use Staq Debug to identify and isolate problematic plugins or themes. Deactivate all plugins and reactivate them one by one in a staging environment to pinpoint the issue.
    4. Review Database Tables:
      Large database tables like wp_woocommerce_log can consume significant resources. Use a tool like Advanced Database Cleaner to optimize and clean up unnecessary data.

    When to Increase Memory

    If the above steps don’t resolve the issue and memory continues to be a bottleneck, it may be necessary to increase memory allocation. For most sites, 256MB is sufficient due to Staq’s highly efficient infrastructure, but here are cases when you may need more:

    • High-traffic websites: A spike in visitors or resource-intensive activities like imports or bulk edits.
    • Memory-intensive plugins/themes: Plugins like ManageWP, WP Activity Log, or themes with known issues (e.g., older Astra versions).
    • Complex sites: E-commerce sites with WooCommerce or heavily customized WordPress builds.

    How to Increase Memory

    If you’ve confirmed the need for higher memory:

    1. Go to the Staq Panel for the site.
    2. Navigate to PHP Config.
    3. Under Request Memory Limit, increase the memory allocation to 512MB or higher, as needed.

    Advanced Debugging Tips

    If memory is not the root cause, here are additional steps to troubleshoot:

    1. Review Logs for Debugging Tools:
      Check if logs (e.g., WordPress debug or WooCommerce logs) are enabled and generating excessive entries, leading to memory exhaustion.
    2. Inspect Plugin and Theme Updates:
      Use the Reports > Plugin & Theme Updates section in Staq to identify recently updated plugins or themes that could be causing the issue.

    Overarching Best Practices

    • Ensure you have debugging or log file generation disabled.
      • Having some form of log files being enabled could be the cause i.e. WordPress debug or WooCommerce logs enabled. By disabling those may resolve the issue.
    • Always update plugins and themes regularly to minimize compatibility issues.
    • Monitor the Reports section in Staq to track updates and performance changes.
    • Enable Staq Automatic Plugin Updates with rollback functionality for stable and secure updates.
    • Optimize your database
      • Database bloat can slow down your site, increase backup times, and consume unnecessary storage, potentially leading to performance issues. To address this, we recommend using the Advanced Database Cleaner plugin to remove expired transients, orphan post metadata, and other unnecessary data. If specific tables, like wp_woocommerce_log, are unusually large, review their content to determine if entries can be cleared or deleted to optimize performance.

    By following these steps, you can resolve server 500 errors effectively and maintain optimal performance for your WordPress site.

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.