Nginx或PHP FPM忽略了php中的memory_limit.ini

2022-08-30 18:44:29

服务器信息: Ubuntu Server, Nginx, PHP FPM

在我有: 在我有:/etc/php5/fpm/php.inimemory_limit = 512M/etc/php5/fpm/php-fpm.confphp_admin_value[memory_limit] = 512M

php_value[memory_limit] = 512M

我的 phpinfo 看起来像这样:

PHP 版本 5.3.10-1ubuntu3.6

系统构建日期

Linux snserver 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 Mar 11 2013 14:34:24

服务器接口

FPM/FastCGI

虚拟目录支持

禁用

配置文件 (php.ini) 路径

/etc/php5/fpm 

加载的配置文件

/etc/php5/fpm/php.ini

扫描此目录以查找其他.ini文件/etc/php5/fpm/conf.d

已解析的其他文件.ini

/etc/php5/fpm/conf.d/curl.ini, /etc/php5/fpm/conf.d/gd.ini, /etc/php5/fpm/conf.d/mcrypt.ini, /etc/php5/fpm/conf.d/memcache.ini, /etc/php5/fpm/conf.d/mysql.ini, /etc/php5/fpm/conf.d/mysqli.ini, /etc/php5/fpm/conf.d/pdo.ini, /etc/php5/fpm/conf.d/pdo_mysql.ini...

本服务器受 Suhosin 补丁 0.9.10 版权保护 (c) 2006-2007 Hardened-PHP 项目 版权所有 (c) 2007-2009 SektionEins GmbH

本程序使用Zend脚本语言引擎:Zend引擎v2.3.0,版权(c)1998-2012 Zend Technologies与Xdebug v2.2.2,版权(c)2002-2013,Derick Rethans

...

memory_limit

1.28亿

upload_max_filesize

10.

in /etc/nginx/nginx.conf:

    user www-data;

worker_processes 2;

pid /var/run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {
    client_max_body_size 20M;

    ##

    # Basic Settings

    ##
    fastcgi_buffers 16 16k;

    fastcgi_buffer_size 32k;

    proxy_buffers 4 512k;

    proxy_buffer_size 256k;

    proxy_busy_buffers_size 512k;

    fastcgi_read_timeout 3600;

    sendfile on;

    tcp_nopush on;

    tcp_nodelay on;

    keepalive_timeout 300;

    keepalive_requests 50;

    #ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;

        #ssl_prefer_server_ciphers on;

        #ssl_protocols TLSv1;

        #ssl_session_cache shared:SSL:10m;

        #ssl_session_timeout 10m;

    types_hash_max_size 2048;

    # server_tokens off;

    # server_names_hash_bucket_size 64;

    # server_name_in_redirect off;

    include /etc/nginx/mime.types;

    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;

    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

问题是,当我改变大小时,将显示新值,但是当我改变时,什么也改变不了。我想在某个地方,memory_limit被覆盖了。但我找不到它。任何人都可以帮我吗?upload_max_filesizephpinfomemory_limit


答案 1

在我有/etc/php5/fpm/php-fpm.confphp_admin_value[memory_limit] = 512M

这对我有用。


答案 2

问题可能出在fpm的进程重复,即使你换了/etc/php5/fpm/php.ini也没有效果。

  • 停止 php5-fpm with (ubuntu): sudo service php5-fpm stop
  • 检查不再有 fpm 进程:sudo ps ax |grep fpm
  • 如果有的话,杀死它所有与:sudo杀死-9 pid
  • 确保终止所有 fpm 进程
  • 重新启动: sudo 服务 php5-fpm 重新启动

推荐