我目前使用PHP CodeIgniter框架並且有圖片上傳表單。當我上傳小文件時,腳本運行沒有任何問題,但是當我選擇一個文件時,可以說3mb上傳,腳本不運行,轉到頁面並顯示「頁面加載失敗」。我檢查了PHP日誌和Apache日誌。 PHP日誌給出了這個錯誤。上傳大文件時發生PHP致命錯誤
PHP Fatal error:
Allowed memory size of 33554432 bytes exhausted
(tried to allocate 20736 bytes) in
/Users/Desktop/localhost/system/libraries/Image_lib.php on line 1155
我想我必須從CodeIgniter的配置文件中更改一些設置,這是一個真正的假設嗎?
這是我目前php.ini的PHP,我認爲這不會引發失敗。
; Maximum allowed size for uploaded files.
upload_max_filesize = 32M
; Must be greater than or equal to
upload_max_filesize post_max_size = 32M
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M ; Maximum amount of memory a script may consume (8MB)
但是頁面沒有加載,然後失敗。點擊提交時,處理權將失敗。
任何提示表示讚賞,在此先感謝。
編輯:
現在我得到這個錯誤改變themtØ64M後,與memory_limit的
PHP Fatal error: Allowed memory size of 67108864 bytes
exhausted (tried to allocate 20736 bytes) in
/Users/Desktop/localhost/system/libraries/Image_lib.php on line 1155
我必須重新啓動服務器嗎? (我在麻瓜,因爲當我改變它並重新加載,它仍然在日誌中說32mb) – Grigor 2013-03-21 17:14:28
現在我得到這個錯誤。 PHP致命錯誤:允許67108864個字節的內存大小耗盡(試圖分配20736個字節)位於/Users/Desktop/localhost/system/libraries/Image_lib.php上,第1155行 – Grigor 2013-03-21 17:15:20
這意味着文件大小對於限制設置。文件有多大?限制必須至少與文件大小一樣大。是的,你需要重新啓動apache才能使更改生效。 – stormdrain 2013-03-21 17:24:17