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

分享 不得不用的15個神奇熱鍵

分享 不得不用的15個神奇熱...

好吧~我學到了,看看有沒有機會用上。 我承認切換桌面跟把視窗快速隱藏的熱鍵是蠻好用的。 不想被發現的...

使用.htaccess關閉特定文件的緩存

使用.htaccess關閉特...

以特定檔案為例 <Files page.php> FileETag None Header unse...

PHP使用array_product()函數求得陣列中的乘積

PHP使用array_pro...

arrayproduct()是PHP中的一個內建函數,可以返回陣列中所有元素的乘積。 例如 $arr...

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