This is a contribution to the Internet Knowledge base.

So about a week ago my installation of Squirrelmail (a web based imap client) went screwy. Specifically every time I went the compose page firefox wanted to know what program it should use to run php files or if I’d prefer to save it to disk. At first it was only replies that would cause the problem, then it was all attempts to go to the compose page.

First point is that the ‘how should I run/save this file’ is caused by the script returning a 0 length file when it runs. Since content-type isn’t being set firefox doesn’t know how to handle it. A 0 length file clearly means that the php is throwing an error before spitting out any text and probably any headers. Obviously the cause of the error is not returned to the browser. As it happens neither is it logged in the apache error log. I had to edit php.ini, which on my machine is stored in /etc/php4/apache2/php.ini. I had to set log_errors to On.

Then I got an error I was familiar with in the apache’s errorlog.

Allowed memory size of 8388608 bytes exhausted (tried to allocate 44 bytes)

PHP has a memory ceiling (8mb default), if the script tries to consume more than that PHP bails. I have no idea why the compose page wants that kind of memory, I assume it is loading messages from the inbox for some reason. It would seem unnecessary, but beyond the scope of getting my compose page to work again.

In the php.ini file is a memory_limit entry set to 8M. Changing that value to 16M ups the memory usage to 16mb which is enough so the compose page will function. You need to reload/restart apache after making this change.

I suppose this means I should delete some old/useless email messages, but that seems like a lot of effort and I’d have to make decisions.