• Resolved ejwheelock

    (@ejwheelock)


    I just created my first WordPress site on my home server (which acts as remote server). I haven’t been able to upload any images to my site. At all. Every time I try, I get the error:

    The uploaded file exceeds the upload_max_filesize directive in php.ini.

    The funny thing is, when I first received this error, I went and changed all the php.ini files I could find to say:
    upload_max_filesize = 64M
    Not only that, but the Upload New Media page on my Dashboard specifically states:

    Maximum upload file size: 64 MB.

    Why would I get that error, if it’s not true, even according to WordPress?
    I’ve been trying to find the answer to this for weeks. I’ve updated the php.ini, the wp-config file. phpinfo() checks out just fine. I restart all services after every change I try. I don’t see any errors in the error logs. I’ve tried big and small images – both jpg and png. I’ve tried numerous ways to upload – to the library, and with theme customizations. Everything gives me the same d*** error. I don’t even know if it’s a WordPress issue! Here is my setup:

    Ubuntu Server 16.04
    Nginx 1.12.1
    PHP 7.0.22
    Using php-fpm if that makes a difference

Viewing 7 replies - 1 through 7 (of 7 total)
  • Jasper

    (@jmstudio)

    try adding this to your php.ini


    upload_max_filesize = 64M
    post_max_size = 64M
    memory_limit = 400M
    file_uploads = On
    max_execution_time = 180

    Angela

    (@angelajholden)

    Hello @ejwheelock,

    Are you absolutely certain you’re editing the correct php.ini file? I just found this on Stack Exchange: https://stackoverflow.com/a/40509926

    This is for Apache, and I realize you have Nginx, but maybe it’s worth a look at the path to your php.ini to make sure it has your settings.

    Thread Starter ejwheelock

    (@ejwheelock)

    Thank you. Yes, I have all those in my php.ini file. I can tell they are correct because the page where I upload the images actually says right there

    “Maximum upload file size: 64 MB.”

    And, I’ve loaded up phpinfo() and it says this:

    Configuration File (php.ini) Path 	/etc/php/7.0/fpm
    Loaded Configuration File 	    /etc/php/7.0/fpm/php.ini
    Scan this dir for additional .ini files   /etc/php/7.0/fpm/conf.d

    That is definitely the php.ini file I’m working with.

    • This reply was modified 7 years ago by ejwheelock.
    • This reply was modified 7 years ago by ejwheelock.
    Jasper

    (@jmstudio)

    is there nothing in Scan this dir for additional .ini files /etc/php/7.0/fpm/conf.d?

    also for test try editing that to some dumb number like 51MB and see if the text changes on your upload screen. that way you’re 10000% procent sure it’s the correct php.ini you’re editing.

    Thread Starter ejwheelock

    (@ejwheelock)

    First, your second question: yes, I’m 1000000% sure I’m editing the correct php.ini file. I first changed it to 100M and saw the change on screen. Then, I changed to 64M and saw it change again to 64 MB on screen.
    For your first question: I looked in the conf.d directory and there are a lot of files. Do you know which one I should look at? Here’s the list:

    10-mysqlnd.ini
    10-opcache.ini
    10-pdo.ini
    15-xml.ini
    20-calendar.ini
    20-ctype.ini
    20-curl.ini
    20-dom.ini
    20-exif.ini
    20-fileinfo.ini
    20-ftp.ini
    20-gd.ini
    20-gettext.ini
    20-iconv.ini
    20-json.ini
    20-mbstring.ini
    20-mcrypt.ini
    20-mysqli.ini
    20-pdo_mysql.ini
    20-pdo_sqlite.ini
    20-phar.ini
    20-posix.ini
    20-readline.ini
    20-shmop.ini
    20-simplexml.ini
    20-sockets.ini
    20-sqlite3.ini
    20-sysvmsg.ini
    20-sysvsem.ini
    20-sysvshm.ini
    20-tokenizer.ini
    20-wddx.ini
    20-xmlreader.ini
    20-xmlrpc.ini
    20-xmlwriter.ini
    20-xsl.ini
    Thread Starter ejwheelock

    (@ejwheelock)

    I’m posting a portion of my php.ini file so I can get a second set of eyes on it. It may be a little thing I’m not seeing. When I change the value of upload_max_filesize near the bottom, the value also changes on my WordPress Upload New Media page.

    [PHP]
    engine = On
    short_open_tag = Off
    asp_tags = Off
    precision = 14
    output_buffering = 4096
    zlib.output_compression = Off
    implicit_flush = Off
    unserialize_callback_func =
    serialize_precision = 17
    disable_functions =
    disable_classes =
    zend.enable_gc = On
    expose_php = Off
    max_execution_time = 300
    max_input_time = 60
    memory_limit = 128M
    error_reporting = E_ALL
    display_errors = Off
    display_startup_errors = Off
    log_errors = On
    log_errors_max_len = 1024
    ignore_repeated_errors = Off
    ignore_repeated_source = Off
    report_memleaks = On
    track_errors = Off
    html_errors = On
    variables_order = "GPCS"
    request_order = "GP"
    register_argc_argv = Off
    auto_globals_jit = On
    post_max_size = 128M
    auto_prepend_file =
    auto_append_file =
    default_mimetype = "text/html"
    default_charset = "UTF-8"
    doc_root =
    user_dir =
    enable_dl = Off
    cgi.fix_pathinfo = 0
    file_uploads = On
    upload_max_filesize = 64M
    max_file_uploads = 20
    allow_url_fopen = On
    allow_url_include = Off
    default_socket_timeout = 60
    Thread Starter ejwheelock

    (@ejwheelock)

    I solved this finally!

    I had another .conf file in my pool.d directory that had upload_max_filesize value in it. I was diligently changing the value in this conf file in addition to the php.ini file.

    php_admin_value[upload_max_filesize] = 64M #comment

    I also had what I thought was a comment in the same line. I suspected this was the issue. Removed the comment. Restarted php and nginx. Voila. I can now upload images!

    Thanks for your help @angelajholden & @jmstudio

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can’t upload images – upload_max_filesize error, but image doesn’t exceed max’ is closed to new replies.