Well this is very strange !
This is my code:
$file_dir = '/home/guru54gt5/public_html/sys/';
$file = $file_dir.'clickbank.xml';
$content = "Starting to process xml file: $file\r\n";
fwrite($handle, $content);
$xml = simplexml_load_file($file);
$cb_xml = $file_dir."a_CB_XML.txt";
$content = "Writing to xml file: $cb_xml\r\n";
fwrite($handle, $content);
if(file_put_contents($cb_xml, print_r($xml, true)))
echo 'worked';
else
echo 'failed';
$content = "Wrote to xml file: $cb_xml\r\n";
fwrite($handle, $content);
exit;
And this is recorded in my log:
New record - Time Stamp: 07:32:38 Monday, 18 January 2010
This script: sys/auto_cb_update.php, This file: /home/guru54gt5/public_html/sys/a_log_cb_update.txt
Starting to process xml file: /home/guru54gt5/public_html/sys/clickbank.xml
Writing to xml file: /home/guru54gt5/public_html/sys/a_CB_XML.txt
The script finishes with no error
(error reporting on) and with no file created
and no echoed output !
I am just going to look at the systems logs...
OK I see that I get this:
Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 18124801 bytes) in /home/guru54gt5/public_html/sys/auto_cb_update.php on line 145
That line is the if(file_put_contents($cb_xml, print_r($xml, true)))
So for some reason it can not handle
the print_r($xml, true) - runs out of mamory.
The xml file is 26 Mb but my system is showing:
Real memory 947.38 MB total, 570.73 MB used
and
Virtual memory 1 GB total, 107.68 MB used
So I don't know why I get this problem 😕