Jonathan Lam
Jonathan Lam

Reputation: 17351

why is this php fatal error message showing?

I'm a novice PHP programmer and not so knowledgeable abouts bits and bytes, and I was wondering why this message even shows up:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40 bytes) in D:\xampp1.8.3\htdocs\hkmschat\default.php on line 227

I know my website is very large, but it loads fast enough, and it would be a pain to change it.

I was wondering, why is allocating 40 bytes too much when the allowed memory size is 134217728 bytes (128 megabytes). Can somebody help me with the meaning of "the allowed memory size" and "allocated memory". Again, I don't know much about these.

I've also changed php.ini's memory_limit value to "256M", but it didn't work then. the error just changed to

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 40 bytes) in D:\xampp1.8.3\htdocs\hkmschat\default.php on line 227

Can somebody please inform me on what I'm missing?

Thanks in advance.

Upvotes: 1

Views: 126

Answers (1)

Zak
Zak

Reputation: 25205

It's not trying to JUST allocate 40 bytes. You already have 128Megs of stuff loaded into memory, and it is trying to then load 40 bytes more. This puts you over the limit, and you get the fatal error. As for the php.ini, there are several versions of php.ini that could be being used. you should use a test page and use a phpinfo(); call to determine that you are modifying the correct php.ini.

Upvotes: 2

Related Questions