WordPress 上傳檔案有檔案大小的限制,要如何變更限制呢?
WordPress 媒體庫的上傳檔案大小是由 php.ini 限制的,可修改 php.ini。修改的步驟如下:
1.確認 php.ini 的位置
用 phpinfo() 函式列出 php 環境設定,欄位[Loaded Configuration File]可以看到 php.ini 存放路徑
2.修改 php.ini 檔
WordPress 媒體庫的上傳檔案大小是由 php.ini 限制的,可修改 php.ini。修改的步驟如下:
1.確認 php.ini 的位置
用 phpinfo() 函式列出 php 環境設定,欄位[Loaded Configuration File]可以看到 php.ini 存放路徑
2.修改 php.ini 檔
3.upload_max_filesize 上傳最大單一檔案大小
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
4.post_max_size POST資料量大小
最好比 upload_max_filesize 再大
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
post_max_size = 8M
最好比 upload_max_filesize 再大
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
post_max_size = 8M
5.memory_limit 記憶體限制
最好比 post_max_size 再大
; Maximum amount of memory a script may consume (128MB)
memory_limit = 128M
最好比 post_max_size 再大
; Maximum amount of memory a script may consume (128MB)
memory_limit = 128M
6.max_execution_time 最大執行時間
上傳檔案越大,上傳所需的時間就越長,執行時間就要調大
; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
上傳檔案越大,上傳所需的時間就越長,執行時間就要調大
; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
7.重新啟動 apache
留言
張貼留言