Last-modified: 2011-12-26 (月) 01:24:44
Pukiwiki/添付ファイルサイズの最大値を変更したい

概要

添付ファイルサイズの最大値を変更します。

方法

  1. 「/usr/local/lib/php.ini」を開き、値を確認します。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
    
     
     
     
     
     
     
     
     
     
     
     
     
     
    
    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit = 128M
     
     
    ; Maximum size of POST data that PHP will accept.
    ; http://php.net/post-max-size
    post_max_size = 10M
     
     
    ; Maximum allowed size for uploaded files.
    ; http://php.net/upload-max-filesize
    upload_max_filesize = 2M
  2. upload_max_filesizeが2Mなので、ここを変更します。
    memory_limit > post_max_size > upload_max_filesizeとなるように設定します。
    今回は10Mに設定します。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
    
     
     
     
     
     
     
     
     
     
     
     
     
     
    
    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit = 128M
     
     
    ; Maximum size of POST data that PHP will accept.
    ; http://php.net/post-max-size
    post_max_size = 12M
     
     
    ; Maximum allowed size for uploaded files.
    ; http://php.net/upload-max-filesize
    upload_max_filesize = 10M
  3. Apacheを再起動します。
    Everything is expanded.Everything is shortened.
      1
    
     
    
    /etc/init.d/httpd restart
  4. 「<Pukiwikiルート>/plugin/attach.inc.php」を開きます。
      1
      2
      3
      4
      5
      6
      7
    
    <?php // NOTE (PHP > 4.2.3):
    //    This feature is disabled at newer version of PHP.
    //    Set this at php.ini if you want.
    // Max file size for upload on PHP (PHP default: 2MB)
    ini_set('upload_max_filesize', '2M');
     
    // Max file size for upload on script of PukiWikiX_FILESIZE
    define('PLUGIN_ATTACH_MAX_FILESIZE', (1024 * 1024)); // default: 1MB ?>
  5. PLUGIN_ATTACH_MAX_FILESIZEの値を修正します。
    upload_max_filesizeですが、コメントにあるとおりここでは変更出来なくなったので、修正は必要ありません。
      1
      2
      3
      4
      5
      6
      7
    
    <?php // NOTE (PHP > 4.2.3):
    //    This feature is disabled at newer version of PHP.
    //    Set this at php.ini if you want.
    // Max file size for upload on PHP (PHP default: 2MB)
    ini_set('upload_max_filesize', '2M');
     
    // Max file size for upload on script of PukiWikiX_FILESIZE
    define('PLUGIN_ATTACH_MAX_FILESIZE', (1024 * 1024 * 10)); // default: 1MB ?>
  6. 正常に動作するか確認して、終了です。

検証時の環境

参考