Loading...


Related Products


Date Published: April 8, 2022

Acquia Cloud Site Factory: Increasing memory_limit with factory hooks

Issue

As an Acquia Cloud Site Factory customer, you may want to make an increase PHP memory limits. 

Resolution

For Acquia Cloud Site Factory, you can either increase the default PHP memory limit or conditionally increase the PHP memory limit for specific pages or paths using factory hooks in a PHP file to the factory-hooks/pre-settings-php directory.

Increase for all requests

To increase to the default PHP memory_limit for all Drupal requests for your subscription, use the easy PHP configuration option available via the Cloud interface.

Increase for a specific page/path

If you need to increase the memory limit only for a certain page or pages, then we recommend increasing the memory conditionally for a given path. This leaves the memory allocated for typical pages with the default value and your site more robust on the ACSF platform. 

Change the "700M" value below to the desired size. 

Drupal 9

in factory-hooks/pre-settings-php/pre_settings.php

<?php
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'admin/structure/menu/') !== false ) {
       ini_set('memory_limit', '700M'); 
    }



Drupal 7

in factory-hooks/pre-settings-php/pre_settings.php

<?php
    if (strpos($_GET['q'], 'admin/structure/menu/') === 0) {
	   ini_set('memory_limit', '700M');
    }

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation
Back to Site navigation