zoukankan      html  css  js  c++  java
  • 解决nginx和php使用ckfinder无法上传大文件的问题

    现象描述:

    cms内容发布系统上传不了大文件,当上传超过32M文件时就上传不了

    提示:无效的文件. 文件尺寸太大。

    分析文件上传过程:

    browser --> nginx --> php  

    需要修改 nginx.conf和php.ini

    1.nginx.conf新增如下参数,重启无效:

    client_max_body_size 512M;
    client_body_buffer_size 128M;
    

      

    2.修改php.ini配置,重启php-fpm无效:

    /usr/local/php-7.0.12_fpm/lib/php.ini
    
    post_max_size = 512M
    upload_max_filesize = 256M
    

      

    资源网站大全 https://55wd.com 我的007办公资源网站 https://www.wode007.com

    3.找到上传文件代码所在的目录 /data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public

    [root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# grep -ri "无效的文件. 文件尺寸太大"
    resources/js/libs/ckfinder/core/connector/php/lang/zh-cn.php:	‘203‘ => ‘无效的文件. 文件尺寸太大。‘,
    resources/js/libs/ckfinder/lang/zh-cn.js:	203 : ‘无效的文件. 文件尺寸太大。‘,
    

      

    发现使用了 ckfinder 这个富文本插件


    经过搜索发现限制在配置文件config.php,修改最大文件问题解决:

    [root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# find ./ -name config.php
    /data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public/resources/js/libs/ckfinder/config.php
    
    $config[‘DefaultResourceTypes‘] = ‘‘;
    
    $dir_name_1 = preg_replace(‘/.+/([^/]*[a-z]+.[a-z]+)/.+/‘, ‘$1‘, $baseDir);
    $config[‘ResourceType‘][] = Array(
    ‘name‘ => $dir_name_1, // Single quotes not allowed
    ‘url‘ => $baseUrl,
    ‘directory‘ => $baseDir,
    ‘maxSize‘ => "300M",	# 修改此处
    ‘allowedExtensions‘ => isset( $_GET[‘show_format‘] ) ? $_GET[‘show_format‘] : ‘‘,
    ‘deniedExtensions‘ => ‘‘);
    
    $config[‘AccessControl‘][] = Array(
    ‘role‘ => ‘*‘,
    ‘resourceType‘ => $dir_name_1,
    ‘folder‘ => ‘/‘,
    
    ‘folderView‘ => true,
    ‘folderCreate‘ => true,
    ‘folderRename‘ => false,
    ‘folderDelete‘ => true,
    
    ‘fileView‘ => true,
    ‘fileUpload‘ => true,
    ‘fileRename‘ => true,
    ‘fileDelete‘ => true);
    
    
    $dir_name_2 = ‘All files list‘;
    $config[‘ResourceType‘][] = Array(
    ‘name‘ => $dir_name_2,
    ‘url‘ => ‘‘,
    ‘directory‘ => ‘‘,
    ‘maxSize‘ => "300M", # 修改此处
    ‘allowedExtensions‘ => isset( $_GET[‘show_format‘] ) ? $_GET[‘show_format‘] : ‘‘,
    ‘deniedExtensions‘ => ‘‘);
    

      

     
  • 相关阅读:
    使用sshfs挂载远程服务器目录
    yum install --downloadonly 下载依赖包到本地 但不安装
    CentOS 7安装SSHFS 实现远程主机目录 挂载为本地目录
    CentOS7下FTP的安装与配置
    标签传播算法(Label Propagation Algorithm, LPA)初探
    线性模型(linear model)基本定义及参数求解数学本质、损失函数的选择与评估数学原理、及其基于线性模型衍生的其他机器学习模型相关原理讨论
    贝叶斯A/B测试
    谨慎选择我们的先验
    关于年会抢红包游戏的一个思考
    WMI攻击技术研究
  • 原文地址:https://www.cnblogs.com/ypppt/p/13371153.html
Copyright © 2011-2022 走看看