---
title: "Acquia Cloud Site Factory: Increasing memory_limit with factory hooks"
date: "2022-04-08T13:45:05+00:00"
summary:
image:
type: "article"
url: "/site-factory/help/92486-acquia-cloud-site-factory-increasing-memorylimit-factory-hooks"
id: "30b9c280-4092-4908-96fb-57997ad100a3"
---

**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](/node/57269) 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](/node/56299).

### 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](/node/92621) 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');
        }