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

如何緩存靜態資源使用HTTP緩存

如何緩存靜態資源使用HTTP...

配置服務器以返回CacheControlHTTP響應標頭: CacheControl: maxage...

php使用PDO獲取結果的方法

php使用PDO獲取結果的方...

fetch() 式例如下: mixed PDOStatement::fetch([int fetch...

使用CSS讓Youtube自動適應寬度跟高度

使用CSS讓Youtube自...

pexelsphotomedia 在播放Youtube影音的時候,常使用 iframe 的方式崁入網...

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