CoreCoder
CoreCoder

Reputation: 419

AWS EMR - how to increase php memory_limit

I am running a job on aws emr which fails with error 'PHP Fatal error: Allowed memory size of 134217728 bytes exhausted'

I tried with adding a bootstrap action script

#!/usr/bin/php
<?php
ini_set('memory_limit', '2048M');
?>

using Master: m1.large Core: m3.xlarge

but it is not increasing memory limit and I still received same error.

how can I increase php memory limit in AWS EMR.

Thanks

Upvotes: 0

Views: 5511

Answers (2)

Rahul Vaghela
Rahul Vaghela

Reputation: 211

    please try this one in php.ini not in apache

    php_value memory_limit 2048M

    and also try this way in .htaccess

Notice: This method will only work if PHP is running as an Apache module.
Find the “.htaccess” in your root directory of the specified domain, if there isn’t, create one. Put the following line in it.

php_value memory_limit 128M; /* Change the 128M to your needs */

Upvotes: 0

Raggamuffin
Raggamuffin

Reputation: 1760

A simple google search for AWS php ini brought up this:

https://serverfault.com/questions/543077/how-to-add-directives-to-php-ini-on-aws-elastic-beanstalk

The cleanest way I found is to use a .ebextensions config file in my project archive:

Sample .ebextensions/project.config file:

files:   "/etc/php.d/project.ini" :
    mode: "000644"
    owner: root
    group: root
    content: |
      upload_max_filesize = 64M
      post_max_size = 64M 

When the application version is deployed, this will write a custom config file in the php.d directory, that will override any php.ini setting.

Upvotes: 0

Related Questions