You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress媒体上传报错:临时文件写入失败,求解决方案

WordPress临时文件写入错误排查方案

问题详情

上传105KB图片时触发以下错误:

There was an error opening the temp file /var/www/html/wp-content/wmufs-temp/1-df8c69043ae11dd7f1af1bd76a7dd2f6c7fafcaa.part for writing. Available temp directory space may be exceeded or the temp file was cleaned up before the upload completed.

已完成的排查操作:

  • 清空服务器所有tmp文件夹(包含wmufs-temp)
  • 创建新tmp文件夹并修改上传指向
  • 确认磁盘剩余空间超过40GB,WordPress上传限制为128MB,服务器端上传限制为500MB
  • 仅变更操作:新增域名指向站点,未迁移服务器

排查与解决步骤

  • 检查临时目录权限
    确保wmufs-temp(或新指定的临时目录)的所有者和权限匹配web服务器运行用户:

    • 所有者通常为www-data、apache或nginx,执行命令修正:
      chown -R www-data:www-data /var/www/html/wp-content/wmufs-temp
      chmod -R 755 /var/www/html/wp-content/wmufs-temp
      
  • 验证PHP临时目录配置
    检查php.ini中的upload_tmp_dir参数:

    • 创建phpinfo文件查看该参数值,确认指向的目录存在且权限正确
    • 若配置无效,修改php.ini并重启服务:
      upload_tmp_dir = /var/www/html/wp-content/custom-temp
      
  • 排查域名配置冲突
    新增域名后,检查站点核心配置:

    • 确认wp-config.php中的WP_HOME和WP_SITEURL与新域名匹配
    • 检查.htaccess文件,排除重写规则导致的路径异常
  • 测试插件冲突
    错误路径中的wmufs-temp大概率关联Multisite File Uploader类插件,临时禁用该插件,使用WordPress原生上传功能测试,确认是否为插件逻辑问题

  • 检查服务器自动清理机制
    查看服务器是否有定时清理临时文件的任务(如systemd-tmpfiles、自定义cron),排除临时文件被提前删除的可能

内容的提问来源于stack exchange,提问作者Marcelo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 17:30:01