Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Static Publisher Issue


Go to End
Reply

12 Posts   1660 Views

Avatar
ttyl

8 October 2010 at 11:01am Community Member, 114 Posts

This is a strange problem that took me a while to properly identify and if anybody could give me some advice I'd be very grateful.

First off I am using static publisher for caching. When I run mysite.com/dev/buildcache from the browser everything works as expected. However, I'd prefer to have it a nightly cron job. To that end I've gone through all the steps to get sake working, and it does - mostly. The odd thing that happens is any top-level pages that use images from dataobjects or other pages simply don't output images, but sub-pages do.

For example, I have a 'news' page that has an image. my home page has a widget that pulls the newspage image. if I build the cache from the browser the images are there. if I build it from the command line they are not. if I make a second home page that is a subpage of the original home page the sub page will have the images but the home page (top level) will not when building from command line. this identical code, only difference is one is a subpage.

anybody know what to make of this? it's really the last hurdle to finish a site and it's confounding me...

thanks!

Avatar
ttyl

9 October 2010 at 3:03am Community Member, 114 Posts

anybody? this is really killing me, final step to finish this project.

Avatar
ttyl

9 October 2010 at 3:49am (Last edited: 9 October 2010 4:20am), Community Member, 114 Posts

also, I'm using 2.4.1, php 5.2.6, mysql 5.0.77

nothing useful in my logs

I get this in my logs...

[08-Oct-2010 11:12:04] Warning at sapphire/filesystem/GD.php line 392: imagejpeg(): SAFE MODE Restriction in effect. The script whose uid is 10002 is not allowed to access /var/www/vhosts/MYSITE/httpdocs/assets/_resampled/SetSize13792-lev-header.jpg owned by uid 48 (http://MYSITE/past-events)

Avatar
banal

9 October 2010 at 4:21am Community Member, 901 Posts

If opening /dev/buildcache in the browser works, why use sake at all?
Simply create a cronjob that calls yoursite.com/dev/buildcache directly using wget, curl, or even php?

It should be as simple as calling

curl http://yoursite.com/dev/buildcache


from within cronjob...

Avatar
ttyl

9 October 2010 at 4:28am (Last edited: 9 October 2010 4:29am), Community Member, 114 Posts

you have to be authenticated to do that

Avatar
banal

9 October 2010 at 4:38am Community Member, 901 Posts

I see. I guess you could even login using curl but that might be too complicated.
Quite possibly you're running the cronjob as another user than the user php or apache runs as. That's why you get the access error.
Did you try to set your assets folder permissions to 0777 (recursively)?

Or maybe issue the sake calls as the "apache-user" (sometimes called www)

Avatar
ttyl

9 October 2010 at 5:09am Community Member, 114 Posts

same thing when I run as apache, very weird. and sub-pages are fine btw, only top-level pages.

Avatar
banal

9 October 2010 at 5:29am Community Member, 901 Posts

Setting permission bits on the asset folder didn't help either?
That it affects top-level pages only is indeed very weird though.

Go to Top