Fatal error on file_put_contents() NOT related memory_limt, execution time, input_time in php
Dear Experts,
I get one php script, csvextract.php, as attached in code area, and I found the error message
"Fatal Error: Out of memory(allocated 3123000)(tried to allocate 71 bytes) in /home/.../csvextract.php line 17"
at the line 17 is exactly at file_put contents() function location.
And I already check my php.ini file and .htaccess file, those are already setting correct memory_limit=128M,
max_execution_time=0, max_input_time=-1, so I believe the error message is NOT related to
memory_limit, max_input_time, max_exexcution_time.
SO what other factors or setting in php.ini will affect the file_put_contents() function ? Is the fatal error
related to magic_quotes_sysbase() and magic_quotes_runtime() ? I got confused about how to use
magic_quotes_sysbase!
When I cut down the file of "data.csv" file size by half or number of row in the file by half,
it is passed and no any error message.So I suspect $csv variable to store the array from file() can NOT
be too much size. Do you think so.? Is there any setting in php.ini related to parsing variable size like $csv as follows
Be reminded my fatal error message is out of memory(allocated 3123000)(tried) and NOT "Allowed memory size 100k exhausted"
If memory_limit is not set correctly, it will report error like " Allowed memory size 100k exhausted" for example only
Oh you asking for help and threatening people at the same time? Good luck :-)
duncanb7
ASKER
If you think so, it is not, just hope you conside and read the thread title in detail before you making any fast comment
a1j
This is probably error returned from malloc which means that probably OS denied allocation. Why? Because your ulimit can be set to low numbers.
But I will not follow this thread anymore - you are very rude and need to learn how to work with people.
Hope you can help and be serious to ask and write down what you are asking in detail at least more words for
other people to be understood
duncanb7
ASKER
I am sorry to you and because I got a lot experience there is a lot of people who just play it aroud not serious.
please stay these thread and I will re-open this thread , your last thread is more kind and more show to others
that you are sincerely to help others because of more explaination.
I will follow your suggestion no matter that is right and wrong because you are serious to reply this thread
Vimal DM
Hai,
use the below lines on top of ur pages
ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
ini_set("max_execution_time", 0);
ini_set("memory_limit", "10000M");
The file size of data.csv is just below 1meg byte only
duncanb7
ASKER
It is same as before if change to
ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
ini_set("max_execution_time", 0);
ini_set("memory_limit", "10000M");
It seems the system not allow $csv is too big in memory from
file_put_contents("data.csv",$csv);
duncanb7
ASKER
Dear Adm,
Please help to reactivate this thread and I get the final answer to this thread