Loading...

Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 12288 bytes) in

Temperature: 0 °C

Mark ChangMark Chang
author_tools

今天在客戶的網站系統上發現了一個問題。
在上傳檔案時發生了一個錯誤:

Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 12288 bytes) in

錯誤的原因:
因為php頁面消耗的最大記憶體預設是為8M,如果檔案太大或圖片太大,在讀取的時候會發生上述提示錯誤。
解決方式,我直接在該處理PHP檔案裡加入以下設定:
ini_set("memory_limit","20M");

20M是可以依據自己的需求去設定。
又或者是修改.htaccess:
php_value memory_limit 20M


以上紀錄~

#故事  #PHP  #memory size  #Fatal error  #htaccess  
https://innstory.com/story-Fatal_error_Allowed_memory_size_of_50331648_bytes_exhausted_tried_to_allocate_12288_bytes_in-2741
PHP

Prev
 使用_htaccess_關閉緩存

Next
直接在PHP重新命名帶有前綴的sessionname 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

PHP無法保存SESSION的問題

PHP無法保存SESSION...

一天,客戶反應系統後台無法登入。 而這問題是發生在客戶電腦更換了IP位置。 而我這邊也只是開放新的I...

javascript change css class

javascript cha...

javascript 使用classList是一個方便的替代方法,可以將元素的類列表作為空格分隔的字...

如何修復Undefined Index錯誤訊息

如何修復Undefined ...

錯誤的原因是因為當我們使用 $GET 和 $POST 方法取得變數時會發生這種情況,雖然PHP的部分...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format