Problem retrieving attachment.

Submitted by norhamin on 2010-10-21

Hi. I have problem retrieving several attachment especially when it is more than 60MB. When I am trying to open or save the file for later usage, the will be a message describing that file either damage (decode problem) or doesn’t support format. For you information most of the attachment are in PDF format.

I have try to locate the attachment file in the storage folder and copy it into my computer desktop using ftp client. I change the file format to PDF and surprisingly I can open the file without any error. I am wondering how this can be happened. Most of attachment doesn’t have that kind of problem.

For your information, I am using CentOS 5.5, Apache 2.2.3 and MySQL 5.0.77. Post_max_size and upload_max_filesize variables in /etc/php.ini have been set to 100MB.

post_max_size = 100M
upload_max_filesize = 100M

Finally I found the solution for this problem and I would like to share the information with you guys. For some reason, I had decided to have a relook to Apache server log and found some strange message error which is "[Wed Nov 17 19:03:50 2010] [error] [client 192.168.XXX.XXX] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 76920832 bytes) in /var/www/html/webissues/index.php on line 1098"

The meesage error shows us that the PHP memory size has reach its limit and cannot cater for the remaining file attachment process. I have decide to increase the PHP memory limit to 500M to prevent future message error regarding to this issue. To perform that I had run this command which is "perl -i -p -e 's\memory_limit = 128M\memory_limit = 500M\g' /etc/php.ini". You also may use any word editor such as gedit, wordpad, vim, nano.etc) to change the PHP memory limit value in the php.ini configuration file.

Once everything has completed, you require to start the Apache webser. I am using the following command for my linux machine which is "service httpd restart". By now we should attach the file bigger than 50MB without any problem. You also might consider to change the "post_max_size" variable to at least two times bigger than "upload_max_filesize" capacity to prevent any file transfer distruption.

norhamin[at]yahoo[dot]co[dot]uk