Results 1 to 3 of 3

Thread: Web host claims script is utilising 40MB (only 9MB upload)

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    13

    Default Web host claims script is utilising 40MB (only 9MB upload)

    Hello

    I am having all sorts of problems getting larger uploads to get processed by the form. My host doesn't allow me to configure php.ini, but will allow .htaccess.

    My .htaccess is:

    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 300
    php_value max_input_time 300
    php_value memory_limit 40M

    My host advised upping the memory limit to 40MB.

    The error returned is:

    Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 13751236 bytes) in [path to script] on line 8860

    My host says the script is trying to use more than 40MB, which does seem the case, judging by the error. They wish to know if the script is doing anything to the file (like compressing it, or processing it in some way) which may account for the extra memory usage.

    The only clue to the mystery is that when I modify the script to use the file repository (rather than having the upload emailed to me as an attachment) the upload goes through fine. This would suggest that the script is failing when it attempts to email me with the attachment.

    I don't mind having the uploads stored on the server, but I would rather have them emailed back to me for convenience sake.

    The upload in question is a 9MB zip file, containing a TIFF image file.

    Does anyone know how it could be utilising more than 40MB?

    Thanks

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Web host claims script is utilising 40MB (only 9MB upload)

    Hi,

    To send mail, a PHP script must build the entire email in memory.

    Also, attached files can use up to double the memory of the actual file size (due to encoding).

    So, attaching a 40MB file might well use 80MB-100MB or more of memory.

    (In theory, a script could build the email in a file and then execute an external operating system command to send the email from the file. Unfortunately, that's not operating system independent and is not always permitted even when possible.)

    If you need to email large files, then you just need to be able to allocate the memory.

    In the 21st century (with fast 32 bit and 64 bit processors), it's really not unreasonable for any program (including PHP scripts) to temporarily use several hundred megabytes of memory.

    Of course, shared hosting must have limitations to be fair to everyone sharing the resources, and this is one limitation that your host is enforcing.

    Your options are:
    1. Convince your host to allow larger PHP memory allocation.
    2. Upgrade to a VPS (where you have control of the configuration of your server software).
    3. If you can use an external OS command to send email (e.g. "sendmail"), then write additional PHP code to build the email in a file and call that command. You can utilize FormMail's Hook System to incorporate the additional code and still keep all the other functionality of FormMail.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Mar 2010
    Posts
    13

    Default Re: Web host claims script is utilising 40MB (only 9MB upload)

    Thanks for clearing that up, Russell. I thought I was losing my mind.

    I'll see if I can come up with a workaround for my situation.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Script Works, Email Contains No Information
    By JakeForest in forum FormMail Subscription Support
    Replies: 10
    Last Post: 28-Dec-2005, 10:51 PM
  2. Thanks for the great script, but I am having issues...
    By darknightjedi in forum FormMail Subscription Support
    Replies: 12
    Last Post: 26-Aug-2004, 08:08 PM
  3. DEF_ALERT setup in script - Don't understand
    By jodmcc in forum FormMail Subscription Support
    Replies: 2
    Last Post: 17-Jun-2004, 07:02 AM
  4. Great script but.....
    By Remosz in forum FormMail Subscription Support
    Replies: 3
    Last Post: 23-Mar-2004, 10:47 PM
  5. Does your web server send mail?
    By russellr in forum FormMail Subscription Support
    Replies: 0
    Last Post: 10-Feb-2004, 08:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •