【问题标题】:AWS EMR - how to increase php memory_limitAWS EMR - 如何增加 php memory_limit
【发布时间】:2014-08-15 13:17:31
【问题描述】:

我在 aws emr 上运行一项作业,该作业失败并出现错误“PHP 致命错误:允许的内存大小为 134217728 字节已用尽”

我尝试添加引导操作脚本

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

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

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

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

谢谢

【问题讨论】:

  • 如果您可以通过控制台访问您的 AWS 服务器,那么您将不得不通过那里更新 php.ini,因为亚马逊可能出于安全原因禁用了 ini_set
  • 这与 EMR 有什么关系?我错过了什么吗?

标签: php amazon-web-services emr


【解决方案1】:

一个简单的谷歌搜索AWS php ini 提出了这个:

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

我发现最简洁的方法是在我的项目存档中使用 .ebextensions 配置文件:

.ebextensions/project.config 文件示例:

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 设置。

【讨论】:

    【解决方案2】:
        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 */
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-05
      • 1970-01-01
      • 2012-11-12
      • 2020-04-07
      • 1970-01-01
      • 1970-01-01
      • 2022-06-13
      • 2022-11-18
      相关资源
      最近更新 更多