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

要如何知道ajax執行失敗原因?

要如何知道ajax執行失敗原...

只要在error的function 更改為以下寫法即可: error: function (XMLH...

PHP查詢陣列中是否存在特定字串in_array() 函數

PHP查詢陣列中是否存在特定...

使用函數inarray() ,適用版本(PHP , PHP 5, PHP , 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