1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[PHP]Allowed memory sizeの原因がくだらなかった

Last updated at Posted at 2020-03-04

##[PHP]Allowed memory sizeの原因がくだらなかった

100万件のCSVをPHPで読み込むために、メモリ上限を1024MBに変更したが、
相変わらずメモリエラーが発生するのはなぜだろう。

Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes)
 in C:\Users\user_name\htdocs\hoge.php on line 32
PHP Stack trace:

よく見ると、php.iniでmemory_limiを1024MB と書いていた。
MBと書いたことが原因っぽい。

memory_limit = 128M

MB→Mに書き直したら正常に処理できた。(というかデフォルトに戻した)
当たり前すぎるが他にも同じ理由でエラー起こす人がもしかしたらいるかもしれない
ので投稿しました。僕はこれで数日つまづいていました(笑)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?