AWS EMR -如何增加php memory_limit


AWS EMR - how to increase php memory_limit

我正在运行aws emr上的作业,错误为" PHP致命错误:允许的内存大小为134217728字节已耗尽"

我尝试添加一个引导动作脚本

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

使用师父:m1.large核心:m3.xlarge

但它没有增加内存限制,我仍然收到相同的错误。

如何在AWS EMR中增加php内存限制。

谢谢

在google上搜索AWS php ini,出现如下:

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

我发现最干净的方法是在我的项目存档中使用。ebeextensions配置文件:

样本.ebextensions/项目。配置文件:

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

当部署应用程序版本时,这将在php中编写一个自定义配置文件。D目录,那将重载所有php.ini设置

    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 */