• Hi, I installed a brand new version of WordPress last night. Before doing ANYTHING else (changing themes, installing plugins, etc), I tried to upload a 40MB mp4/webm file.

    For everything I did, I got this error: “Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.”

    I googled this to death; there is a solution for Nginx. However, I’m on an Apache server.

    The sysadmin in me and Level 3 tech support of my hosting company spent over 15 hours troubleshooting this.

    We did all the things you’d expect:

    • Tried different accounts (in case the DNS environment, e.g. Cloudflare vs locally hosted DNS records were the issue)
    • Rebuilt Apache
    • Increased limits on PHP (like really, really high), especially the execution time. Reminder: this is a 40MB file. We had our file max size a lot higher than that.
    • Changed PHP versions (8.2 -> 8.3 and back and forth. We’re not going back to 7.x because of it being deprecated and breaking other code on the server)
    • Tried different PHP versions (suPHP / lsapi)
    • Disabled mod_sec
    • Tried smaller files (which worked)
    • Installed WP on CLI vs via FTP
    • …I’m sure there were other steps forgotten here…

    But for whatever reason, when we hit the 35MB or so limit, this error would show up on every WordPress install on this server.

    When the fix for nginx suggests client_max_body_size to be increased to 10M, that’s great. Except it doesn’t apply to Apache.

    And when other random web pages for this error suggest these low limits (really? These are high?), they’re not much help either:

    memory_limit = 256M
    post_max_size = 76M
    upload_max_filesize = 64M

    (Our limits were 512MB and up…)

    So… what’s a person with Apache to do except to switch to Nginx? Seriously. That is what we did as a temporary solution. Not my ideal solution, so I’d like to find the Apache-specific fix to this error.

    To add: there were NO logs – nothing in the web server logs, nothing in error_log, nothing in debug.log that was turned on in wp-config.php (in fact, debug.log was never created). Nothing. We created test environment after failure after failure. No go.

    The four of us (again, level 3 support) believe we exhausted all options and that the solution is “don’t use Apache.”

    That can’t be right. I mean, there are a billion servers out there running WP with Apache that must have no issue with this.

    So… what *is* the solution? What else could we be trying that hasn’t been attempted yet?

    Any real WP experts in Apache who can tell us what we’re overlooking?

Viewing 8 replies - 1 through 8 (of 8 total)
  • rpp

    (@rpfaffenbach)

    May be the permissions are wrong:

    Try

    chmod 755 -R wp-content
    chmod 755 -R wp-content/uploads

    after login to the server. Mostly you can change the permissions with a FTP program like WinSCP.

    Thread Starter tamar

    (@tamar)

    We also checked that. All wp-content/uploads/2023/12 were already 755 (drwxr-xr-x). Could’ve tried 777 but images were being uploaded, just not large files.

    rpp

    (@rpfaffenbach)

    I’ve only really noticed it now. As far as I know webm is a not allowed mime type.
    What happens if the video is uploaded as a “normal” mp4?

    Thread Starter tamar

    (@tamar)

    i only did .webm once just to see if it would process. I always tried mp4.

    rpp

    (@rpfaffenbach)

    Is there any .htaccess file in your upload folder? If so you can rename it via ftp and try to upload the mp4.


    Check the .htaccess in your root folder for something like this

    php_value upload_max_filesize 64M
    php_value post_max_size 128M
    php_value memory_limit 256M
    php_value max_execution_time 300
    php_value max_input_time 300

    Next possible cause could be the functions.php of your theme

    @ini_set( 'upload_max_size' , '64M' );
    @ini_set( 'post_max_size', '64M');
    @ini_set( 'max_execution_time', '300' );
    

    If you have a wordpress multisite you can increase filesite in menu settings in your wordpress dashbard.

    wp.config.php in root

    @ini_set( 'upload_max_size' , '20M' );
    @ini_set( 'post_max_size', '13M');
    @ini_set( 'memory_limit', '15M' );

    I can’t think of any other places where the maximum upload size can be set.
    Otherwise, only debug.log and error.log can possibly provide more information about the cause.

    Thread Starter tamar

    (@tamar)

    They can be set universally on php.ini, no? That’s how they were defined and the limits were much higher.

    I tried three sites with multiple themes including a vanilla install of WordPress with just the defaults.

    rpp

    (@rpfaffenbach)

    I’m running out of ideas now. And without knowing the exact configuration and the conditions on the server, it will be problematic to find a solution here.
    Maybe someone else has an idea?

    Normally, the change in php.ini is sufficient. And the Apache server does not need to be restarted afterwards. However, this may depend on the provider’s installation.

    It is unusual that there is no indication of a possible cause in the logs.

    I hope you have also reloaded the page after the change in php.ini or elsewhere? If not, the changes will not take effect.

    I can’t think of anything else that could be the cause. In any case, I could not reproduce the problem on my site (provider and local).

    Thread Starter tamar

    (@tamar)

    Right, this is leaving four of us seasoned sysadmins stumped. I have no idea what we could possibly do to even find out what the issue is.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Vanilla install of WordPress on Apache upload issues’ is closed to new replies.