Config php ini file for upload files

南笙酒味 提交于 2019-12-01 08:39:16

问题


I have a page for upload files, In .htaccess file I have this:

php_value upload_max_filesize 40M
php_value post_max_size 40M

I have an img, with size 1.6 MB. When I am trying to upload this image, I obtain the error below.

Fatal error: Allowed memory size of 54525952 bytes exhausted (tried to allocate 3600 bytes) in....

Does anyone know how to solve this problem?


回答1:


if you can cant access php.ini on server then write below in your .htaccess file

php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M



回答2:


You need to set following values to increase file upload size

    file_uploadsile_uploads
    upload_max_filesize
    max_input_time
    memory_limit
    max_execution_time
    post_max_size

Cheers



回答3:


As far as I can tell, you're probably exhausting the memory_limit of PHP, that is, PHP is trying to allocate an amount of memory greater that the memory_limit param value.

Maybe you're uncompressing the image on the fly or copying some data that needs too much memory to be allocated, try increasing that limit.




回答4:


You have memory_limit in your PHP configuration; 54525952 bytes which is 52MB.

You should configure memory_limit in php.ini or .htaccess or fix memory leak.



来源:https://stackoverflow.com/questions/12260453/config-php-ini-file-for-upload-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!