我目前使用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