Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous difference between App.webroot and App.wwwRoot #838

Open
othercorey opened this issue Apr 14, 2021 · 5 comments
Open

Ambiguous difference between App.webroot and App.wwwRoot #838

othercorey opened this issue Apr 14, 2021 · 5 comments
Labels
Milestone

Comments

@othercorey
Copy link
Member

The documentation shows them being essentially the same:

     * - webroot - The webroot directory.
     * - wwwRoot - The file path to webroot.

        'webroot' => 'webroot',
        'wwwRoot' => WWW_ROOT,

However, wwwRoot uses a path from paths.php wile webroot hard-codes the same directory in the config.

/*
 * File path to the webroot directory.
 *
 * To derive your webroot from your webserver change this to:
 *
 * `define('WWW_ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], DS) . DS);`
 */
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);

When would you want the webroot separate from the path? Asset loading from plugins don't use either of these, but instead hard-code the directory name webroot/ in source.

@othercorey othercorey added this to the 4.x milestone Apr 14, 2021
@markstory
Copy link
Member

The only use cases I remember around App.webroot are when URL rewriting is off, and the application is in a subdirectory. Plugins are different because their static assets are either served by middleware or the webserver and deployment tooling.

@othercorey
Copy link
Member Author

There is one direct use of WWW_ROOT in cakephp/cakephp, but it's in ServerCommand.

The only use of App.webroot is in ServerRequestFactory::updatePath():

        $endsWithIndex = '/' . (Configure::read('App.webroot') ?: 'webroot') . '/index.php';

@github-actions
Copy link

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the stale label Aug 13, 2021
@othercorey othercorey added pinned and removed stale labels Aug 13, 2021
@github-actions
Copy link

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

@dereuromark
Copy link
Member

Do we want to tackle this for 5.next or 6.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants