On Tue, Oct 13, 2009 at 11:23 AM, Josh K <joshkrae...@gmail.com> wrote:
>
> When I enabled mod_write in CakePHP, I set my .htaccess files
> according to 
> http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess.
> Accessing the URLs work fine with this default setup.
>
> However, $webroot now  = /, which means paths using the webroot
> variable are incorrect:
>
> file_get_contents($_SERVER['DOCUMENT_ROOT'].$this->webroot .
> "templates/email.html") outputs
>
> home/user/public_html/templates/email.html
>
> but it should be
>
> home/user/public_html/app/webroot/templates/email.html (correct path)
>

Use WWW_ROOT:

file_get_contents(WWW_ROOT.'templates/email.html')

Think of WWW_ROOT as a modified $_SERVER['DOCUMENT_ROOT'], on account
of the redirects that Cake uses. As far as Apache is concerned,
DOCUMENT_ROOT is '/home/user/public_html' (you were missing the
leading /, btw) while, from Cake's perspective, it's actually below
that. Hence the need for a new constant, WWW_ROOT.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to