fuel/oil — Issue #101: DOCROOT constant doesn't point to the same location as public/index.php
Author: crynobone
Created: 2012-01-01 12:31:33+00:00
State: open

This introduce an inconsistent result when running from oil (cli) and public/index.php (web) when you try to include custom feature.

## Scenario
In my case, I was trying to use a simplified config.php file inside public/ folder for db configuration (this would be useful to create a web-app style deployment).

APPPATH.'classes/view.php',
'Controller' => APPPATH.'classes/controller.php',
));

// Register the autoloader
Autoloader::register();

if ( ! is_file(DOCROOT.'config.php'))
{
throw new \HttpNotFoundException();
}
else
{
include DOCROOT.'config.php';
}

## Excepted Behavior
Running from web and cli would work without any problem.

## Actual Result
oil failed to run anything because DOCROOT return different path.

> You rejoined the room.
[11:36am] crynobone: WanWizard: got a minute?
[11:58am] golonka joined the chat room.
[12:00pm] golonka left the chat room. (Client Quit)
[12:10pm] WanWizard: crynobone: whats up?
[12:11pm] crynobone: is there any reason why DOCROOT in oil and public/index.php doesn't point to the same folder
[12:11pm] crynobone: WanWizard: ^
[12:11pm] sluther left the chat room. (Quit: Bye!)
[12:11pm] WanWizard: don't know
[12:11pm] crynobone: can we make it the same?
[12:12pm] WanWizard: in both cases it points to the directory the script is in. don't know what happens if you change it
[12:12pm] WanWizard: try it out
[12:13pm] crynobone: yeah
[12:13pm] crynobone: or should we add another constant
[12:13pm] crynobone: ie WEBROOT?
[12:14pm] crynobone: it would be easier if for instance oil want to lookup file in assets folder, or other related stuff
[12:16pm] crynobone: had a scenario where i need it before, but forgotten
[12:17pm] GitHub-Commit left the chat room.
[12:17pm] GitHub-Commit: [core/1.1/develop] new Asset class. Closes #741 - WanWizard
[12:19pm] WanWizard: crynobone: DOCROOT is used only once in oil, for loading phpunit. that might be done differently, in which case it would be save to alter DOCROOT
[12:19pm] WanWizard: create an issue for it so Phil can have a look
[12:19pm] crynobone: ok