Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
DOCROOT differs between oil tasks and regular classes
  • Hi, I'm having a problem with the DOCROOT constant. In my regular controllers, DOCROOT is /home/mysite/public (where public is the Fuelphp public folder, and mysite is the root of the Fuelphp installation, i.e. the default directory structure), but when I run a task via the command line or cron, DOCROOT is just /home/mysite Is there any way of making DOCROOT the same whether in class run through the browser or through the command line? Thanks, Matt
  • I hope DOCROOT is "/public" anyway. Because wrote in Document.
    > DOCROOT Path to the public directory (/path/to/public).
  • For your web application it is. For oil, it isn't, since it's not in public.
  • By default, DOCROOT is defined as the location where the 'startup script' is, which indeed can be different for oil and your applications index.php. Like with all other constants that are defined, they just contain a default. If they don't match your environment or the way you want to use them, feel free to change them.
  • DOCROOT being different in Oil is a good reason for me to use APPPATH for paths in my code. This should be the same no matter where you run FuelPHP from.
  • We had an internal discussion about it, and the default stays as it is. If you don't like the default, open 'oil' in your favorite editor, and edit the definition. That's what they are there for.
  • Thanks. That's what I've done. Only concern is that each update will overwrite it, so I'll have to be careful to change DOCROOT again each time.
  • DOCROOT is the word DocumentRoot from NCSA httpd or Apache, isn't it?
    For me, it implies always "public".
  • For everything served through your webserver, yes. But oil is a commandline utility, it doesn't have anything to do with your webserver.
  • The oil loader, like your index.php, is part of the app package. In general you will never update that as a package, as it contains your application code. If you have to upgrade it, you'll have to go through all files anyway. Currently, you had to do this once if you had a 1.0 app that needed migrating to 1.1. So I think 'each time' is slightly exaggerated... Furthermore, your app code should be in a repository too, which means you can just merge the new version in. If there are no conflicts, the merge would take care of preserving your DOCROOT change.
  • I mean, It is better DOCROOT is always "/path/to/public/".
    Because it is a word of Web, and less confusion. And you said, real meaning of DOCROOT is where startup script is.
    So it is better to add another constant for it. Or is the word DOCROOT proper for the current specification?
    If so, there is no problem. I don't know English well.
    Anyway, I send a pull request, https://github.com/fuel/docs/pull/336
    the current spec documentation to reduce confusion.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion