Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reciving this message (also when doing cron)
This is probably related to permissions, could someone point me to solve?
just installed location + gmap via drush.
Thank you so much
Comment | File | Size | Author |
---|---|---|---|
#50 | 1114164_not_in_cli_mode.patch | 386 bytes | greggles |
#27 | gmap-unable_to_save_marker_bundle-27-7.x-1.x-dev.txt | 560 bytes | RadioActiv |
#9 | patch-gmap.module-7.x-1.x-dev.txt | 568 bytes | florisg |
Comments
Comment #1
4aficiona2 CreditAttribution: 4aficiona2 commentedsubscribe
Comment #2
4aficiona2 CreditAttribution: 4aficiona2 commentedIt seems that you can easily fix that. I also installed gmap and gmap location via drush and got the same error.
Then I checked the permissions in the in the module directory sites/all/modules of the gmap module. theses where slightly different so I changed them to 775, where the owner/group is www-data.
Then I checked the permissions in the sites/default/files directory where actually my js files get stored. For some reason the owner was root instead of www-data so I changed the owner and group to www-data.
sudo chown www-data -R js
sudo chgrp www-data -R js
hope this works for you.
Comment #3
federico.bebber CreditAttribution: federico.bebber commentedThank you, solved with your suggestions.
Comment #4
thetruthkc CreditAttribution: thetruthkc commentedThis worked for me.sorry, I changed owner/group even permissions to 777 on the entire directory (/sites/all/modules/gmap) and still no luck when I "Regenerate marker cache"
Comment #6
skwashd CreditAttribution: skwashd commentedThis is still a problem. I just hit it using 7.x-1.x from git.
The module was installed with drush make, but enabled in via the webgui. Even "drush dre -y gmap" didn't fix it. In sites/default/files/js I have gmap_markers.js
Let me know if you need more info to track it down.
Comment #7
metakel CreditAttribution: metakel commentedstill got this error after running cron. I'd chmod to 775 and the gmap_markers.js is already changed to user and group of the webserver (www-data).
Comment #8
metakel CreditAttribution: metakel commentedI've just tried the method of #1167594: Saving gmap_markers.js needs catch errors. I'd edited the "gmap.module" and found that the error message was printed by the below "if" statement (it is false), around line 555:
Just before this if condition statement the $dir was defined:
So I'd changed it to a hard coded path:
Now the error message was gone. So the culprit is that "public://" prefix. Do you have any idea to deal with it?
Comment #9
florisg CreditAttribution: florisg commentedThat worked for me metakel :)
For migration purpose i changed line 547:
$dir = $base_path . "/sites/default/files/js/";
Why this so nice solution of "public://" file paths does not work in this instance i do not know.
Comment #10
metakel CreditAttribution: metakel commentedYour solution still does not work with a multisite configuration (but should be good enough for most people).
I have come up with another problem which deal with the public:// prefix here regarding the filefield_path module
#1051736: Unable to upload files: writing to "~/public_html/public:" and "~/public_html/private:"
I can't tell whether it is related. I would like to find more information on the mystical public:// but I can find none. I wish I can hard code it in some place like settings.php rather than letting the system to detect on its own.
Comment #11
podaroksubscribe
Comment #12
fazen CreditAttribution: fazen commentedsubscribe
Comment #13
fazen CreditAttribution: fazen commentedI think the problem arises with the is_writable call inside file_prepare_directory.
With my (writable!) "js" folder:
gives
false
andgives
true
.Comment #14
bitcore CreditAttribution: bitcore commentedWindows server here.
I ran into this, and after a few days, found a solution. I've ascertained that when file_save_data is called with drupal's default file scheme 'public://', drupal will create a temporary file using the system's temp directory, and then it copies the file out of the temp directory to where it's actual home will reside. Why it won't just create the file where it's supposed to go in the first place is beyond me. There are too many layers of abstraction for a someone who picked up drupal a week ago to really find out, and I really don't care - it works now. Anyone who runs drupal on their own WAMP box should run ProcessMonitor and just see the number of filesystem calls that one pageview generates - I was absolutely staggared. ok, /end old crotchety performance snob rant.
Anyways, the problem was, for some reason, apache did not have read access to the system temp folder. On windows, it was using the system environment variable TEMP or TMP - which, as you could guess, pointed to c:\windows\temp\ on my system.
I gave the apache service read access to this directory, and the problem disappeared. I have full admin access to my machine, so way back when, I've set up the apache process to run under it's own user account so I can assign permissions with more granularity. I don't know if this caused my problem in the first place, or made it more secure and easy to fix. Either way, it immediately started working after the permissions change.
Metakel, take a look at the API documentation for: file_save_data, it briefly describes what public:// is. It also states that the function requires the destination to be a stream wrapper API. Placing an absolute directory path in there is apparently "not a good idea." However, I suppose if it works, & you only have one drupal install/site to mess with, do it. You may want to check your system & apache logs to make sure you aren't stuffing them with warnings about the directory/
http://api.drupal.org/api/drupal/includes--file.inc/function/file_save_data
Comment #15
Gill Xu CreditAttribution: Gill Xu commentedsame issue, +1
Comment #16
ewills CreditAttribution: ewills commentedSubscribe
Comment #17
snez CreditAttribution: snez commentedsubscribe
Comment #18
robertcottrell CreditAttribution: robertcottrell commentedzoorock's #2 simple permissioning fix just worked for me now. With the footnote that you then need to hit the "regenerate" button on the GMap configuration page. Thanks!
Comment #19
Liam_Mc CreditAttribution: Liam_Mc commentedHi all,
I have tried all the suggestions above but am still getting the error:
* The data could not be saved, because the destination is invalid. More information is available in the system log.
* Notice: Trying to get property of non-object in gmap_regenerate_markers() (line 555 of /var/www/clients/client0/web1/web/sites/all/modules/gmap/gmap.module).
This started after I moved the site to a new server. The site is Drupal 7.8. I think I have tried all variations of owner / permissions on the gmap module directories and default/files/js.
Any help or ideas would be most welcome.
The error can be seen here: http://www.hadrianorganics.co.uk/buy
Many thanks,
Liam
Comment #20
Liam_Mc CreditAttribution: Liam_Mc commentedSeems to be working now, not sure exactly why, but it might have been the creation of a new tmp directory in sites/default. Not sure if this is wise, but it seems to have worked for me.
Comment #21
jenlamptonI noticed that the gmap_markers.js file inside /sietes/default/files was the only file in there that was not owned by my drupal-user, and in the group of my drupal-user. For some reason it retained the permissions of the module (where it originated).
I didn't even know it was possible for the server to copy a file retaining it's original owner and group, but let's figure it out :)
Comment #22
crashtest_ CreditAttribution: crashtest_ commentedJust as an aside to this topic, it may happen that if you are transferring a site from one server to another, and you have the old gmap_markers.js file in the sites/default/files/js directory, you may just want to blow it away and let it recreate it. That is the only thing that made the error go away for me. It was creating files just fine in my tmp directory but still giving me the error. I think there was some cached file id that it was trying to find in the filesystem because it could see that the file existed, but wouldn't load it. Weird.
Comment #23
megan_m CreditAttribution: megan_m commentedThat worked for me too, thanks for the tip.
Comment #24
Khumbu CreditAttribution: Khumbu commentedsubscribe
Comment #25
jessicakoh CreditAttribution: jessicakoh commented#22, Thank you, CrashTest_
It works. So easy.
Comment #26
gazwal CreditAttribution: gazwal commentedidem for me too :
#22, Thank you, CrashTest_
It works. So easy.
Comment #27
RadioActiv CreditAttribution: RadioActiv commented#22 didn't fix it for me, but changing line 550 in gmap.module from
$dir = "public://js/";
to$dir = drupal_realpath("public://js/");
fixed the errors.
Patch attached in case anyone else is still having this issue.
Comment #28
Bagz CreditAttribution: Bagz commentedHad the same issue. Was caused by incorrect permission on the public file system path (usually sites/default/files) which prevented files being created in that folder. Setting the permission to 755 on that folder fixed the problem.
Comment #29
metakel CreditAttribution: metakel commentedIt is strange that I always set the "files" directory's premission to 775 (which the Apache server's "www-data" is both the user and the group of that directory). However the error message still appears. But when I applied the modification of #27, the error is gone.
Comment #30
pinkonomy CreditAttribution: pinkonomy commentedI still have this issue,although tried all above methods.Not only I take this message,but also when I save a marker it doesn't save.
Comment #31
funature CreditAttribution: funature commented#22 works for me too
Comment #32
yngens CreditAttribution: yngens commented#27 solved similar issue for me.
Comment #33
caspervoogt CreditAttribution: caspervoogt commentedThanks for this. It worked for me.
shortcut;
sudo chown www-data:www-data -R js
Comment #34
ericxb CreditAttribution: ericxb commented#27's a neat little fix. Thank you, RadioActiv. Permissions on the public://js dir in my case were wide open www:www 775 and yet GMap was throwing this error whenever I attempted to use drush to update.
I've found other examples which call
file_prepare_directory("public://js")
; so it appears to be an accepted paradigm. What's mystifying is thatfile_prepare_directory()
simple callsis_dir()
onpublic://js
without translating it to a file system path first.I only see this error when running drush (as root); and
gmap_markers.js
usually has today's date; so I have to think that the drush runtime environment somehow lacks a public schema translation effect? (enter Rod Serling stage right). One also has to wonder why the file needs to be written so often?Comment #35
ericxb CreditAttribution: ericxb commentedOopsie....
(removed issue tags)
Comment #36
BeatnikDude CreditAttribution: BeatnikDude commented#22 did NOT work for me
#27 did work for me
~thanks
Comment #37
maxplus CreditAttribution: maxplus commentedThanks,
#27 also worked for me
Comment #38
calte CreditAttribution: calte commented#27 Works.
RTBC++
Comment #39
metakel CreditAttribution: metakel commentedSame here: #22 does not fix it, but #27 is working.
Comment #40
BeatnikDude CreditAttribution: BeatnikDude commented2¢: a simple fix, worth a commit
Comment #41
rajeesh CreditAttribution: rajeesh commented#22 work s for me. Thanks..:)
Comment #42
podarokfixing title
Comment #43
podarok#27 commited to 7.x-2.x branch
thanks!!!
Comment #44
podarok#27 commited to 7.x-1.x branch
thanks!!!
Comment #45
podarokstatus
Comment #46
podarok#1831410: Single Markers disappeared after upgrade to version 2.6
possibly related
reopening issue
Comment #47
podarok#44 reverted due to #1831410: Single Markers disappeared after upgrade to version 2.6
need work
Comment #48
BeatnikDude CreditAttribution: BeatnikDude commented#27 works for me... again.
Comment #49
bradjones1I had noticed this error message occasionally on cache-clears, but it was never a problem for me until I tried updating drupal core with drush, and the error caused drush to abort the upgrade.
The problem appears not to be with gmap.module per se, but with file permissions. If you run a drush cc, for instance, as a user other than the webserver, gmap's attempt to overwrite gmap_markers.js will fail, because it's owned by www-data:www-data (or similar for your server.) If you sudo and run the same command as www-data, you will succeed. Or, manually change the ownership of gmap_markers.js to you:www-data with group-writable permissions (which will persist as Drupal overwrites the file during cron). Either way, I don't think this is a problem with gmap's code.
Also re: #27, changing the URI to an absolute path shouldn't make any difference; file_prepare_directory handles URI's or paths interchangably.
Comment #50
greggles@bradjones1 - I also have this problem only when clearing cache with drush, but tweaking permissions didn't help. I tried the "you:www-data" with 776 on the file and the parent directory but that didn't help. I tried chmod -R 777 (on my dev site, of course) and that also didn't help.
Assuming this is only a problem for people using drush to clear cache in some way, what if we just don't run this in cli mode?
I'll admit that I don't think I've ever actually had a problem with gmap where clearing the markers was the solution, so it's possible that I'm not considering how important it is to clear this on every cache clear.
Comment #51
seanburlington CreditAttribution: seanburlington commentedI see this problem a lot with this module - in places where the permission seems OK to me
Would it make sense to modify file permissions if these are detected as incorrect ?
eg
file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
as far as I can see the code doesn't even try to do this so if it detects what it thinks are incorrect permissions it will fail
NB I've seen this error when running as root - I think that is_writable() fails to take into account that root can ignore the set permissions
I am unsure if it can account for permissions set via setfacl
Comment #52
gp177 CreditAttribution: gp177 commented#50 worked for me.
Please consider for inclusion as soon as possible. As someone who is responsable for patching a large number of Drupal sites, Drush functionality is borderline manditory.
Comment #53
trevorw CreditAttribution: trevorw commentedPatch in #50 works for drush cc all error here
Comment #54
bradjones1@greggles - +1 for applying the old medical adage, "if it hurts when you do X, just stop doing it."
I think this would be good for RTBC but the testbot is out to lunch on the patch in #50?
Comment #55
guy_schneerson CreditAttribution: guy_schneerson commentedPatch in #50 fixed it for me
Comment #56
gregglesFor folks saying that #50 works, it would be interesting to know if you see any new bugs introduced.
Comment #57
Anonymous (not verified) CreditAttribution: Anonymous commentedJust an FYI update, greggles #50 worked to remove the error from my Drush cc, but Drush up still returns, "GMap is unable to save the marker bundle. Markers will not work!" error and reverts to backup. Unable to update using Drush.
Also, the location with current dev release is now around line -543 not -553.
Comment #58
podarok#50 looks like "I do not want to see a bug" but not a real fix
Comment #59
greggles@podarok - that's roughly right, but do we have any idea why the markers are getting cleared on every single site-wide cache clear? Maybe doing that in the first place is the actual bug here. That action should probably only be taken when it needs not and not quite to indiscriminately.
Comment #60
gregglesI dug back and the change was made in 2008 but there's no issue in the queue associated with the change.
http://drupalcode.org/project/gmap.git/commitdiff/377bdc3298ebc146620acb...
Prior to that it could be cleared explicitly from a gmap admin page, but wasn't cleared as part of the global cache clearing.
Comment #61
rurri CreditAttribution: rurri commentedThis bug breaks getting updates for this module using drush
Comment #62
gregglesComment #63
podarok#62 what king of review this needs?
Comment #64
gregglesThe review needed is more description of what a "real" fix would look like if you are truly unhappy with this one.
Several people have delivered functional reviews (#57 #54, #53, #52) saying that the patch in #50 works for them and they didn't notice any side effects. So, we know that the patch in #50 fixes an annoying real problem for people.
I did research to find that the "feature" was introduced without discussion of merit of either the idea or the implementation.
I find it upsetting and demotivating that buggy code was introduced in 2008 and now we can't get rid of it because the proposed fix doesn't feel "real" enough.
If you need more information from me to understand why this is a problem I'd be happy to give that information. Here are the steps I went through to try to get rid of the issue:
1. Confirmed ownership of everything in my files directory to be the same user as the webserver
2. Tried setting the gmap directory and files to 777 permissions
Neither of those fixed it though both my own investigation and comments from others made me think that they should help.
Comment #65
rurri CreditAttribution: rurri commentedTurns out that for us this broke more than just updating this module with drush. It appears to break almost any drush command.
Uninstalling module allows us to use drush again. So I can definitively attribute our drush problems to gmap.
May I ask the rationale behind calling regenerate_markers so often? Shouldn't this be something just done at install and maybe a clear cache hook?
Comment #66
greggles@rurri - can you test the patch in #50?
Comment #67
podarok#50 commited pushed to 7.x-2.x and 7.x-1.x
thanks to @greggles
Comment #68
gregglesMy thanks to you, podarok :)
Comment #69
podaroktag
Comment #70
jordan8037310 CreditAttribution: jordan8037310 commented#50 got me up and running on 7.x-2.3
Comment #71
crutch CreditAttribution: crutch commented#22 and #27 fixed it for GMAP 7.x-2.9 three years later :)
Comment #72
imoghis CreditAttribution: imoghis as a volunteer and commentedI basically just changed the permissions to 775 at sites/default/files to reflect 775 and it fixed my problem. I guess everyone's got a different issue. Mine was particularly with the webform entirety module. Talk about learning the school of hard knocks. :)