Hi.
I installed the module in a new site and when i check the xml file i got an empty page.
http://www.todo-peleas.com/sitemap.xml

I have got a message in the admin page that could be the problem :P
"Unable to load site map. Make sure your temporary directory exists and is writable by Drupal."

I dont know where the temporary directory is.

I have tried all the alias for that web page,
/gsitemap/0 etc.

I have pathauto and clean urls installed.

Thanks for your help

Comments

dami’s picture

By default, temporary directory is set to /tmp, which is at the same level where your public_html or www directory is. You can change it in drupal admin panel.

I have 2 sites at the same host (site5.com), but I am using their multisite plan, so these two sites are physically under 2 different directories: /home/site1/ and /home/site2/. Both sites have the same setup, using default /tmp directory. Interestingly, gsitemap works perfectly fine for site1 but not for site2. (Same error:temperary directory not wirtable.) Both /tmp folder has permission 755. So I am really puzzled...I haven't tried chmod 777, does it bring any security problem? Thanks.

Anonymous’s picture

Title: XML not working at all » empty XML sitemap
Component: Documentation » Code
Category: support » bug

Same problem here. The Sitemap is empty and no error messages appear in the protocol. Maybe it's a PHP problem because on my dev-server (PHP 5) the sitemap is created without errors. The live server has PHP 4.4.6.

dami’s picture

Just a follow up, changed /tmp to 777 didn't help. Still the same error msg: temporary directory not writable or not exist ....

bacchus101’s picture

I have the same issue.

For some reason if I go to: Administration --> File System and change the temporary directory to /files it works.

All the permissions are equitable to /tmp so I am not sure what is causing the issue but in my situation the redirect to files serves the need and produces an XML Sitemap.

darkpollo’s picture

when i tried to change it into /files it shows a text that say: that folder doesnt exist... :S
I had noticed that tmp doesnt exist also, so i created it.

I have php 4 also on my server so could be a reason to fail. Anyone more with php4?

Anonymous’s picture

I recently noticed that my problem wasn't related to php4. I changed the tmp-Directory and now everything works fine.

dami’s picture

mglanznig: Can you give some details what changes you made to tmp-dir? Did you change it to /files, or created a new subdir under your drupal installation, and what's the new directory permission? Thanks.

Anonymous’s picture

I created a new sub directory under the drupal root called tmp. I think the privileges for creating directories inside my old tmp dir where missing or something like that related to access rights.

dami’s picture

Thanks, it works for me. What did was followed mglanznig's instruction, using 'tmp' instead of '/tmp' as the temporary directory. Looks like it has something to do with how the absolute path is translated...

darkpollo’s picture

Change /tmp into tmp fix the problem.
Thank you very much!
:D

darkpollo’s picture

Status: Active » Fixed
minimism’s picture

Status: Fixed » Active

I'm not sure that this is a fix for everyone - at least, not for me. I have tried different tmp directories etc., but I still have an empty XML file... I've posted my system details here. It's rather annoying, because I have a sitemap working on one site, but no another!

http://www.rapitasystems.com/sitemap.xml - DOES work
http://namke.com/sitemap.xml - DOESN'T work

rousehouse’s picture

Same issue here until I changed my "/tmp" setting for temporary files to my "files" directory (off the root of my drupal site). I created a new "tmp" directory by changing the setting to "files/tmp", and it's working great.

minimism’s picture

Like I said, this is not a fix for everyone - I have the following set:

file system path:
files
temporary directory:
files/tmp (doesn't work)
tmp (doesn't work)

download method is public (since I'm using imagecache, which apparently doesn't work otherwise)

The module creates the drupal_gsitemap directory, but does not create the subdirectory. Would the fact that the top-level .htaccess file redirects http://www.namke.com/* to http://namke.com/* be an issue? I can't imagine why, but I'm clutching at straws...

minimism’s picture

Ok, it would seem that the "_gsitemap_update_cache()" function is returning FALSE. A small investigation shows me that the "file_check_directory" function (which should create the directory if it doesn't exist??) is failing when it gets to (in my case) "files/tmp/drupal_gsitemap/namke.com" - i.e. it is not creating the "namke.com" directory.

Ryanbach’s picture

I have the same issue when I use Drupal's normal cache, except that my XML file is corrupt and produces strange characters instead.

vigoncas’s picture

I was tracing code.

When system has enabled safe_mode, mkdir command is affected when trying to create recursive directories.

I paste a comment from official PHP documentation:

When safe_mode is enabled, and you create a directory via mkdir, you can't create a second inside the first because the first folder's user is that one of the webserver and not that one of the script.

In my case, this is the problem and I supposed that I can apply to all places where we need create recursive directories or we have differences between directory owner and user that launchs the script.

If we create directories manually and set the correct owner and permissions, the system can create sitemaps without problems.

Tested :-)

minimism’s picture

Aaaaaahh! Thank you :-) Manually creating the directories has solved it for me. Would be nice to have an automatic solution, but for now I'm happy ;-)

vigoncas’s picture

Problem can be solved creating only one directory with domain name included. For example 'drupal_gsitemap_example.com' instead of 'drupal_gsitemap/example.com'.

It's less elegant than actual solution but it's more flexible and solve problem with recursive paths when safe mode is active.

Anonymous’s picture

The following solution worked for me:

1. I have manually created a temp directory in my drupal root directory, called tmp
2. I have manually set its permissions to wrxwrxwrx (777)
3. I have set tmp to my Temporary directory under Home » Administer » Site configuration
4. I have manually created drupal_gsitemap directory under tmp
5. I have manually set its permissions to wrxwrxwrx (777)
6. I have manually created www.mydomainname.com directory under drupal_gsitemap
7. I have manually set its permissions to wrxwrxwrx (777)

remove existinig folders, if they exist with wrong permissions

afagioli’s picture

In my case, there was nothing to do with the tmp directory.

My system was just missing the php5-zlib - PHP5 Extension Module

I've added my very easy hack at the file

gsitemap.module:1146

if (!function_exists('gzencode'))
{
die ("NO gzencode function available. Maybe you want to add the php5-zlib - PHP5 Extension Module ? ");
} 

Maybe in the next release af the xmlgsitemap module will have a check of the existance of the php zlib module?

More info at http://www.fagioli.biz/?q=drupal-5-xml-sitemap-create-empy-site-map

Riccardo83’s picture

ok guys, I got it working that sitemap is created in

/httpdocs/files/tmp/drupal_gsitemap/www.jbsoulscan.com/

but

/httpdocs/sitemap.xlm is not created at all ? why?

Laurel Papworth’s picture

slightly different fix worked for me - changed admin->site config ->file system from /tmp to straight tmp (no slash). Worked fine.

Darren Oh’s picture

Status: Active » Fixed

Fixed in CVS commit 83400.

Darren Oh’s picture

Title: empty XML sitemap » Empty XML sitemap in PHP safe mode
Anonymous’s picture

Status: Fixed » Closed (fixed)
yecarrillo’s picture

Status: Closed (fixed) » Active

I got same error. My HTTP_HOST is subdomain.domain.com:8080, so Drupal is unable to create folders with ":". Please use other ENV vars or cut non alphanumeric characters.

Darren Oh’s picture

Status: Active » Closed (fixed)

This was fixed. If you're not comfortable using the dev release, you can wait for the next stable release.

sentinelcz’s picture

Category: bug » support

Hello for all,
I need help with XML sitemap and safe mode.
1.I have TMP folder with 777 - ok.
2.Temporary files are created in this folder -ok.
3.In TMP folder these files stays without moving.
They have permission only 600, read, write - what is problem.
I tried to change in these files permission to 777, because I hoped that files will process.
In FTP program occurs message "/tmp/filenZd9GV: Operation not permitted".
Is this problem of Drupal or provider?
How could I solve it?
Thank you for help.

shohaml’s picture

Project: Google Sitemap » XML sitemap
Version: 5.x-1.10 » 5.x-1.4
Component: Code » xmlsitemap
Status: Closed (fixed) » Active

I refer to the new xmlsitemap, and not gsitemap.

I had a couple of errors:
1) the system always complained that the temporary file (file) in the temp directory is unreadable.
2) the system was unable to find the xmlsitemap directory in the 'files' directory.

After many trials, and some code dwelling, I got to the following solution:
1) Don't care where your Drupal temporary files reside, as long as the directory is 777 (depends on your host preferences for running Apache).
2) The actual sitemap files are always inside 'files/xmlsitemap'. Make sure this path exists, and set to 777.
3) Once the initial files (gss.xsl, sitemap.xml.gz) are created in 'files/xmlsitemap', make sure to change their permissions to 777.

That fixed everything for me.

Darren Oh’s picture

Project: XML sitemap » Google Sitemap
Version: 5.x-1.4 » 4.7.x-1.x-dev
Component: xmlsitemap » Code
Status: Active » Closed (fixed)

Please do not change the topic of old issues. See issue 197104 for a discussion of this issue in XML Sitemap.

sentinelcz’s picture

THKS - shohaml
My problem was that xmlsitemap was missing in files folder.
to Darren Oh
OK, I apologize for wrong place.

sonicthoughts’s picture

changing to tmp worked for me!