i have issues with this on my server when i am running cron.
here is what i can say based on a similar topic.
1) a page loads at something like ~/.
2) You reference another page located at ~/../private/hello/derp.php
3) inside derp.php it is under the assumption that you are running the file from ~/../private/hello/.'
4) in actuality you are running it from ~/.
5) file references are wrong because PWD is wrong.
it was annoying for my stuff to figure out but when i was looking at it in depth, i relized it was trying to load stuff from something like ~/../private/hello/images/hi.jpg where in actuality because of PWD, it was looking in ~/images/hi.jpg which didnt exist.
Maybe this helps you. I hope it does.
Edit You also want to know that a lot of time, the ~/. for YOU can be different then the ~/. of PUBLIC. That is also something to keep note of.
Try to make proper use of terminal variables via bash scripting.