Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

php - Error: Allowed memory size of 67108864 bytes exhausted

When I upload a picture

  • File size: 375kb
  • Width: 2000px
  • Height: 3000px

I get an error

ERROR Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2157 bytes) in...

Why this happen, when 67108864 = 64MB?

I use a shared server. My .htaccess is:

<IfModule mod_rewrite.c> 
   RewriteEngine on 
   RewriteRule    ^$ webroot/    [L] 
   RewriteRule    (.*) webroot/$1 [L] 

</IfModule> 

where must I write php_value memory_limit 128M?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems you only have 64M (67108864 / 1024 / 1024) allocated to PHP.

If you have access to your php.ini, increase the max memory size.

You can also do it in a bootstrap PHP script.

ini_set('memory_limit', '128M');

Or even in your .htaccess

php_value memory_limit 128M

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...