PHP memory limit exceeded

Very occasionally, when running certain more advanced or demanding PHP based scripts on your website you may experience an error message that looks similar to the following:

Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 184320 bytes) in /home/username/public_html/data/phpBB2/includes/page_header.php on line 372

This is due to the fact that all hosting accounts have a memory limit allocated to them for PHP scripts. In the event of receiving such an error message, this means that your PHP script has tried to use more memory than is allocated to your account.

Please note that this set limit is not per site overall, this is a session (or visitor) limit and so if you have one visitor on your site and the script requires 8Mb of memory, having 10 people on the site at the same time may therefore require 80Mb of memory and as we do not place a limit on the number of visitors then this can lead to large amounts of memory being consumed on the server which obviously only has a certain physical amount available. We therefore have to place limits on how much memory can be used as otherwise this can mean that one or two larger sites can use an unfair proportion of the servers memory and so cause adverse affects on other customers sites on the same server. Additionally, our hosting accounts are priced with the default limits set being taken into account.

All of our cPanel hosting accounts have a very generous PHP memory limit of 128Mb set  which should normally be more than sufficient for the majority of scripts as very few use over 32Mb. Should you however have a script that requires more memory allocating to it, this would indicate that your script is not suitable for a shared hosting platform due to the resources that it requires. In this case, we would recommend considering moving your site over to a VPS or a dedicated server so as to be able to accomodate whatever your script requirements are. Our support staff will be happy to advise you as to the best course of action required.

  • 36 Users Found This Useful
Was this answer helpful?

Related Articles

What is the path to perl?

The path to perl in your scripts should be set as:/usr/bin/perl 

What is the absolute path to my webspace?

The absolute path to your website root directory is: /home/username/public_html/Username should...

What is the path to sendmail?

The path to sendmail to be used in your scripts is:/usr/sbin/sendmail 

I need a PHP setting changed

We aim to have PHP on our servers configured to achieve a balance between the majority of...

How to I enable SSI's (Server Side Includes)?

SSI's (Server Side Includes) are enabled on all accounts as stanadard. In order to make use...