fwrite, fopen and fclose errors
« on: October 03, 2010, 11:35:02 PM »
Hello,

I had to "Minimize script memory usage, " and enable "use temporary files to store crawling progress" in order to avoid "allowed memory size of 268435456 bytes exhausted."

The stand-alone xml-sitemap generator has completed OK, or so it seems.

However, the PHP/httpd log shows these messages:

PHP Warning:  fopen(.../generator/data/sitemap.html) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in .../generator/pages/class.html-creator.inc.php(2) : eval()'d code on line 188
PHP Warning:  fwrite(): supplied argument is not a valid stream resource in .../generator/pages/class.html-creator.inc.php(2) : eval()'d code on line 189
PHP Warning:  fclose(): supplied argument is not a valid stream resource in .../generator/pages/class.html-creator.inc.php(2) : eval()'d code on line 190
PHP Warning:  fopen(.../generator/data/sitemap2.html) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in .../generator/pages/class.html-creator.inc.php(2) : eval()'d code on line 188
. . .

This is the "ls -al" output for .../generator/data/sitemap.html

-rw-r--r-- 1 uuuuuuuu uuuuuuuu 262764 Sep 26 03:51 sitemap.html

I'm looking forward for your assistance.

Thank you in advance.
Re: fwrite, fopen and fclose errors
« Reply #1 on: October 04, 2010, 08:09:48 AM »
Hello,

looks like sitemap.html file has a different "file owner userid", so you would need to set 0666 permissions for that file.
Re: fwrite, fopen and fclose errors
« Reply #2 on: October 04, 2010, 03:14:25 PM »
Hello,

Thank you for your response.

Unfortunately, it's not just one "sitemap.html" file. The xml-sitemap created thousands of files and folders with owner uuuuuuuu and permissions 644 under the "data" and "data/progress" folders. There's a corresponding fopen, fwrite and fclose error message for every one of these thousands of files.

Xml-sitemap didn't have problem creating these files, why didn't xml-sitemap create these files with correct permission in the first place?  

It there an automatic way to handle this issue?

Thank you,
Alex.
« Last Edit: October 04, 2010, 03:22:53 PM by spider2010 »
Re: fwrite, fopen and fclose errors
« Reply #3 on: October 04, 2010, 08:33:48 PM »
Hello,

that might happen if you run generator both in browser and in command line (or cron). You can remove all files from data/ folder, leave just sitemap files there.
Re: fwrite, fopen and fclose errors
« Reply #4 on: October 05, 2010, 02:33:03 AM »
Hello Oleg,

It makes sense. The XML-sitemap cron job has failed due to exceeding the memory limit.

Then, I'd enabled "use temporary files to store crawling progress" and resubmitted XML-sitemap manually via internet browser.

I've removed all files from data/ folder,  and left just sitemap files there -- as you've instructed. Will wait for the next cron job to run.

Thank you for your assistance!