I have trouble getting the absolute path with cakephp while using a shell. Shell do not load all the files like normal www files do. So i think is a file i need to load but i don’t know which…
What have i done already
- I have tried
echo $this->Html->image($this->Html->url('/pluginName/image.gif',true));, normally this would work but not this time… it appears as if the true is not there and a relative path is set. - define(‘FULL_BASE_URL’,’http:/domain’); this one works but is not portable, i need a solution that is portable since this shell may run from different servers that have different images absolute path (same name but the domain changes.
What i need
- It needs to be portable.
- It needs to give me the full url.
- It has to work within a shell.
Thanks in advance
The problem is that there is no web request when running a shell. The generated URLs are always relative to which URL the app was invoked with. On the shell, there is no URL to be relative to, and there can’t be a default URL since the app could be invoked from any number of URLs. You’ll need to hard-code the URL to be available in the shell.