Home › Knowledgebase › KB-1147

Why Your Website is Hanging: Diagnosing PHP Memory Limits on Australian Shared Hosting

Summary

This guide helps you troubleshoot and resolve: Why Your Website is Hanging: Diagnosing PHP Memory Limits on Australian Shared Hosting. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

Shared hosting environments allocate a specific amount of server memory to every website hosted on the same physical machine. When your website attempts to use more memory than your plan allows, the PHP process may terminate abruptly. This typically results in slow loading times, intermittent crashes, or "white screen of death" errors. For small businesses in Australia, this often happens as traffic grows or as plugins and scripts become more resource-intensive.

Most Australian shared hosting providers operate data centres in Sydney or Melbourne to reduce latency for local visitors. Support is generally provided during Australian Eastern Standard Time (AEST) or Australian Eastern Daylight Time (AEDT) business hours. Because resources are shared across multiple accounts on the same server, your host may enforce hard memory limits that cannot be overridden by your own configuration files.

Understanding PHP Memory vs Database Memory

It is important to distinguish between PHP memory and database memory. The PHP memory limit controls how much RAM a PHP script can use while executing code, such as loading a page or processing a form. Database memory refers to the RAM allocated to the database server (such as MySQL or MariaDB) for caching queries and table data. Exhausting the PHP limit produces errors like "Allowed memory size exhausted," while database pressure typically manifests as slow query responses or "Too many connections" errors. Both can cause your website to hang, but they require different remedies.

Diagnosing the Problem

1. Monitoring Resource Usage

Log in to your hosting control panel and navigate to the resource usage or statistics section. Look for spikes in memory consumption that correlate with the times your website hangs. If you notice consistent peaks hitting your limit, your site has likely outgrown its current shared hosting allocation.

2. Checking Your Current PHP Memory Limit

Before making changes, verify your current memory limit using one of the following methods:

WordPress Sites

  1. Log into your WordPress admin dashboard.
  2. Navigate to Tools > Site Health > Info.
  3. Expand the Server section and look for PHP memory limit.

Non-WordPress PHP Sites

  1. Create a new file named info.php in your website's root directory.
  2. Add the following code to the file:
<?php phpinfo(); ?>
  1. Open the file in your browser (for example, https://yourdomain.com.au/info.php).
  2. Search the page for memory_limit to see the current value.
  3. Delete the info.php file immediately after checking, as leaving it exposed is a security risk.

3. Checking Server Error Logs

Review your server error logs via your hosting control panel to confirm if PHP memory limit errors are being recorded. Look for messages such as "Allowed memory size exhausted" or "Fatal error: Out of memory". Note the time of the errors and compare them with traffic patterns or scheduled tasks.

4. Checking Cron Jobs and Background Processes

Scheduled tasks and background scripts can consume significant memory, especially if they run simultaneously with visitor traffic. In your hosting control panel, open the Cron Jobs or Scheduled Tasks section and review the following:

If you identify a resource-heavy cron job, consider rescheduling it to off-peak hours or optimising the script to use less memory.

Increasing the PHP Memory Limit

Caution: Before editing wp-config.php, download a backup copy of the file to your local computer. If you make a syntax error, your website may become inaccessible until the file is restored.

Method 1: Editing wp-config.php (WordPress)

If your website runs on WordPress, you can attempt to increase the memory limit by editing your configuration file.

  1. Access your files via FTP or the File Manager in your hosting control panel.
  2. Locate and open the wp-config.php file in the root directory.
  3. Add the following line of code before the line that says /* That's all, stop editing! Happy publishing. */:
define( 'WP_MEMORY_LIMIT', '256M' );
  1. Save the file and refresh your website to see if the performance improves.
  2. Return to Tools > Site Health > Info > Server to verify that the PHP memory limit now reflects the new value.

Method 2: Using php.ini

Some shared hosting providers allow you to create or edit a php.ini file in your website's root directory.

  1. Open the File Manager in your hosting control panel.
  2. Look for an existing php.ini file in the root directory, or create a new one if it does not exist.
  3. Add or modify the following line:
memory_limit = 256M
  1. Save the file and test your website.

Method 3: Using .htaccess

If your server runs Apache, you can set the memory limit in your .htaccess file.

  1. Open the File Manager in your hosting control panel.
  2. Locate the .htaccess file in the root directory. If you cannot see it, enable the option to show hidden files.
  3. Add the following line at the end of the file:
php_value memory_limit 256M
  1. Save the file and refresh your website to confirm the change took effect.

Method 4: Using user.ini

Some Australian shared hosting environments using PHP-FPM support a user.ini file for per-directory settings.

  1. Create or edit the user.ini file in your website's root directory.
  2. Add the following line:
memory_limit = 256M
  1. Save the file and test your website.
Important: Shared hosting providers often enforce a hard limit that overrides wp-config.php, php.ini, .htaccess, and user.ini settings. If your changes do not appear in Site Health or phpinfo(), your host has likely locked the memory limit at the server level.

Troubleshooting Non-WordPress PHP Applications

If your website is a custom PHP application or uses another content management system, follow these steps:

  1. Review your application's configuration files for memory limit definitions.
  2. Check the application's error logs for "Allowed memory size exhausted" messages.
  3. Identify large array operations, image processing functions, or external API calls that may be consuming excessive memory.
  4. Use memory_get_usage() and memory_get_peak_usage() in your PHP scripts to monitor consumption during execution.
  5. If the application relies on composer dependencies, ensure you are not loading unnecessary packages on every request.

Performance Optimisations and Alternatives

Before requesting a memory increase, consider whether opcode caching or other optimisations can reduce memory pressure:

Common Indicators of an Outgrown Plan

When to Contact Hosting Support

Contact your hosting provider's support team during Australian business hours if:

If you have optimised your application, checked cron jobs, and attempted memory limit changes but continue to experience unreliability, it may be time to migrate to a VPS or dedicated hosting environment. You can discuss upgrade options by visiting the support portal: Open a Ticket.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket