Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Programming
Reload this Page PHP dies on file_put_contents over 4MB
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
Junior Member
TheJBW is on a distinguished road
 
Posts: 1
Join Date: Aug 2012
Default PHP dies on file_put_contents over 4MB - 08-02-2012, 05:56 PM

I have some code that I have written, which constructs an image file from user uploaded partial files (a "chunker"). It is a simple for loop that does a file_get_contents and then a file_put_contents(with the FILE_APPEND flag set). When the total size is <4MB the code successfully produces an output file from the input files. If the total is >4MB, the append operation simply stops at the 4MB point. Interestingly, the client never even gets an HTTP response from the script in this case, as if the thread has been simply killed.

I've tried adjusting .htaccess:
Code:
# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /

php_value memory_limit           300M
php_value session.gc_maxlifetime 10800
php_value max_input_time         10800
php_value max_execution_time     10800
php_value upload_max_filesize    300M
php_value post_max_size          300M
to no avail.

The loop in question:
Code:
for($i = 1; $i <= $count; $i++)
         {
            //echo $dir . $tempdir . $fileName . "_" . $i . "_" . $count .".png";
            $cat_file_part = false;
            while(!file_exists($dir . $tempdir . $fileName . "_" . $i . "_" . $count .".png"))
            {
               //echo "False";
               
            }
            $cat_file_part = file_get_contents($dir . $tempdir . $fileName . "_" . $i . "_" . $count .".png");
            file_put_contents($dir . $fileName . ".png", $cat_file_part, FILE_APPEND);
            //$cat_file .= $cat_file_part;
         }
As you can see, there is no branching that I can see might cause this behavior, so I assume it is a server side setting. Is this a limitation of my free 000webhost account, or am I missing a simple setting (or some basic PHP rule)?
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com