When the server can't provide enough memory to handle a certain PHP request, an error such as this one will present itself in the error log.
1234 xx.com [Thu Jun 18 12:34:56 2019] [error] [client 12.34.56.78:0] AH01215: PHP Fatal error: Out of memory (allocated 167772160) (tried to allocate 80 bytes) in /home/sites/domain.com.com/public_html/index.php on line 2610: /home/sites/domain.com/public_html/file.php
This can be read as: The server has allocated 167772160 bytes to file.php, but failed when attempting to allocate an additional 80 bytes.
index.php in this example would be the requesting file, and file.php would be a file being called by index.php. The server displayed the error when trying to process a line in file.php.
On our shared hosting platform, there is no set limit on PHP usage, but this is monitored to prevent abuse. Sites can use any reasonable amount of PHP memory as long as the server has it available. An application requiring more than 256 MB of memory should ideally need it's own dedicated hosting space.
To determine what is causing these errors, you should inspect the file specified in the error log and look at what actions are being performed around the line number specified. For our example, we'd open file.php (/home/sites/domain.com/public_html/file.php) on line number 2610 to inspect. In most cases the likely cause will be an add-on/plugin for a Content Management System (CMS) which requires additional resources to run.
A quick fix would of course be to increase the limit in your websites php.ini file. If you have a php.ini file already, just edit this, if not create one (it may also be called .user.ini for newer versions of PHP).
The highest we recommend you set on shared hosting would be 512MB:
memory_limit = 512M;
For WordPress users, you can also add the following to your wp-config.php file to match the .ini file:
define( 'WP_MEMORY_LIMIT', '512M' );