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

使用 Closure Compiler 幫 javascript 瘦身

使用 Closure Com...

JavaScript(縮寫為JS)是一種進階的、直譯的程式語言,且作為客戶端手稿語言在使用者的瀏覽器...

使用CSS讓整個網頁由彩色變黑白色!

使用CSS讓整個網頁由彩色變...

blackandwhite5 把下面的語法加入網頁的<head>與</head&g...

在PHP裡添加HTTP Strict Transport Security

在PHP裡添加HTTP St...

要通過 PHP 啟用 HTTP 嚴格傳輸安全,請使用以下設定。 <?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