Reputation: 4059
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
Upvotes: 0
Views: 2280
Reputation: 7895
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.
Upvotes: 3
Reputation: 15639
You have an memory limit of 32M and tried to allocate more memory, so your script failed. Probably you have to large images(image_gd keeps a bitmap in the memory which consumes a lot of memory). What you can do is
Upvotes: 1