duandaiqin6080 2013-03-21 16:52
浏览 88
已采纳

上传大文件时出现PHP致命错误

I am currently using PHP CodeIgniter framework and have an image upload form. When I upload small files the script runs without any trouble, but when I select a file that's, lets say 3mb to upload, the script doesn't run, takes to a page and says "Page failed to load." I checked the php log and apache log. PHP log gave this error.

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

I guess I have to change some settings from CodeIgniter's config file, is this a true assumption?

This is my current php.ini for PHP, which I think doesn't trigger the failure.

; 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)

But the page doesn't load, then fail. It fails processing right when I click submit.

Any hints are appreciated, thanks in advance.

EDIT:

Now I get this error after changing themt o 64M, along with the 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
  • 写回答

2条回答 默认 最新

  • duandanai6470 2013-03-21 16:57
    关注

    Both of these directives will fail since the file size is > 32MB (as it's at least 33554432 bytes).

    ; Maximum allowed size for uploaded files. 
    upload_max_filesize = 32M
    
    ; Must be greater than or equal to 
    upload_max_filesize post_max_size = 32M
    

    In addition, you will need to increase memory_limit.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗