Craft install via composer: install to public_html?

Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
When I do composer create-project craftcms/craft, it will create a web folder. My webroot is called public_html though. Can I change this somehow, or should I make a symlink?
Or simply don't use composer to install in that case?
install composer
add a comment |Â
up vote
4
down vote
favorite
When I do composer create-project craftcms/craft, it will create a web folder. My webroot is called public_html though. Can I change this somehow, or should I make a symlink?
Or simply don't use composer to install in that case?
install composer
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
When I do composer create-project craftcms/craft, it will create a web folder. My webroot is called public_html though. Can I change this somehow, or should I make a symlink?
Or simply don't use composer to install in that case?
install composer
When I do composer create-project craftcms/craft, it will create a web folder. My webroot is called public_html though. Can I change this somehow, or should I make a symlink?
Or simply don't use composer to install in that case?
install composer
install composer
edited Aug 23 at 13:49
asked Aug 23 at 12:43
Urs
2669
2669
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (DonâÂÂt forget to move the .htaccess and .env files, if the latter.)
As long as the location of the public_html/ folder is in the same place as the web/ folder was, you donâÂÂt need to change anything else.
my-project.test/
âÂÂâÂÂâ config/
âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
If you need to change the location to something like this:
my-project.test/
âÂÂâÂÂâ craft/
â âÂÂâÂÂâ config/
â âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).
// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));
// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');
But won't that breakcomposer updatefor later maintenance?
â Urs
Aug 23 at 13:48
1
No it won't. Composer update installs everything into/vendor. All my projects use/publicinstead of/web.
â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:home/craft(withconfig,modules,storage,templateandvendor, not accessible via web),home/public_html(with the content ofweband a modifiedCRAFT_BASE_PATH)?
â Urs
Aug 23 at 13:59
In that case just make sure that theCRAFT_BASE_PATHconstant inpublic_html/index.phpis pointed at thecraft/folder.
â Brandon Kelly
Aug 23 at 16:08
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (DonâÂÂt forget to move the .htaccess and .env files, if the latter.)
As long as the location of the public_html/ folder is in the same place as the web/ folder was, you donâÂÂt need to change anything else.
my-project.test/
âÂÂâÂÂâ config/
âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
If you need to change the location to something like this:
my-project.test/
âÂÂâÂÂâ craft/
â âÂÂâÂÂâ config/
â âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).
// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));
// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');
But won't that breakcomposer updatefor later maintenance?
â Urs
Aug 23 at 13:48
1
No it won't. Composer update installs everything into/vendor. All my projects use/publicinstead of/web.
â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:home/craft(withconfig,modules,storage,templateandvendor, not accessible via web),home/public_html(with the content ofweband a modifiedCRAFT_BASE_PATH)?
â Urs
Aug 23 at 13:59
In that case just make sure that theCRAFT_BASE_PATHconstant inpublic_html/index.phpis pointed at thecraft/folder.
â Brandon Kelly
Aug 23 at 16:08
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
add a comment |Â
up vote
6
down vote
accepted
You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (DonâÂÂt forget to move the .htaccess and .env files, if the latter.)
As long as the location of the public_html/ folder is in the same place as the web/ folder was, you donâÂÂt need to change anything else.
my-project.test/
âÂÂâÂÂâ config/
âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
If you need to change the location to something like this:
my-project.test/
âÂÂâÂÂâ craft/
â âÂÂâÂÂâ config/
â âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).
// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));
// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');
But won't that breakcomposer updatefor later maintenance?
â Urs
Aug 23 at 13:48
1
No it won't. Composer update installs everything into/vendor. All my projects use/publicinstead of/web.
â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:home/craft(withconfig,modules,storage,templateandvendor, not accessible via web),home/public_html(with the content ofweband a modifiedCRAFT_BASE_PATH)?
â Urs
Aug 23 at 13:59
In that case just make sure that theCRAFT_BASE_PATHconstant inpublic_html/index.phpis pointed at thecraft/folder.
â Brandon Kelly
Aug 23 at 16:08
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (DonâÂÂt forget to move the .htaccess and .env files, if the latter.)
As long as the location of the public_html/ folder is in the same place as the web/ folder was, you donâÂÂt need to change anything else.
my-project.test/
âÂÂâÂÂâ config/
âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
If you need to change the location to something like this:
my-project.test/
âÂÂâÂÂâ craft/
â âÂÂâÂÂâ config/
â âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).
// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));
// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');
You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (DonâÂÂt forget to move the .htaccess and .env files, if the latter.)
As long as the location of the public_html/ folder is in the same place as the web/ folder was, you donâÂÂt need to change anything else.
my-project.test/
âÂÂâÂÂâ config/
âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
If you need to change the location to something like this:
my-project.test/
âÂÂâÂÂâ craft/
â âÂÂâÂÂâ config/
â âÂÂâÂÂâ ...
âÂÂâÂÂâ public_html/
âÂÂâÂÂâ index.php
âÂÂâÂÂâ ...
Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).
// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));
// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');
edited Aug 23 at 16:11
answered Aug 23 at 12:56
Brandon Kelly
28.6k45106
28.6k45106
But won't that breakcomposer updatefor later maintenance?
â Urs
Aug 23 at 13:48
1
No it won't. Composer update installs everything into/vendor. All my projects use/publicinstead of/web.
â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:home/craft(withconfig,modules,storage,templateandvendor, not accessible via web),home/public_html(with the content ofweband a modifiedCRAFT_BASE_PATH)?
â Urs
Aug 23 at 13:59
In that case just make sure that theCRAFT_BASE_PATHconstant inpublic_html/index.phpis pointed at thecraft/folder.
â Brandon Kelly
Aug 23 at 16:08
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
add a comment |Â
But won't that breakcomposer updatefor later maintenance?
â Urs
Aug 23 at 13:48
1
No it won't. Composer update installs everything into/vendor. All my projects use/publicinstead of/web.
â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:home/craft(withconfig,modules,storage,templateandvendor, not accessible via web),home/public_html(with the content ofweband a modifiedCRAFT_BASE_PATH)?
â Urs
Aug 23 at 13:59
In that case just make sure that theCRAFT_BASE_PATHconstant inpublic_html/index.phpis pointed at thecraft/folder.
â Brandon Kelly
Aug 23 at 16:08
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
But won't that break
composer update for later maintenance?â Urs
Aug 23 at 13:48
But won't that break
composer update for later maintenance?â Urs
Aug 23 at 13:48
1
1
No it won't. Composer update installs everything into
/vendor. All my projects use /public instead of /web.â Jay
Aug 23 at 13:50
No it won't. Composer update installs everything into
/vendor. All my projects use /public instead of /web.â Jay
Aug 23 at 13:50
Ok! So that would also be a valid setup:
home/craft (with config, modules, storage, template and vendor, not accessible via web), home/public_html (with the content of web and a modified CRAFT_BASE_PATH)?â Urs
Aug 23 at 13:59
Ok! So that would also be a valid setup:
home/craft (with config, modules, storage, template and vendor, not accessible via web), home/public_html (with the content of web and a modified CRAFT_BASE_PATH)?â Urs
Aug 23 at 13:59
In that case just make sure that the
CRAFT_BASE_PATH constant in public_html/index.php is pointed at the craft/ folder.â Brandon Kelly
Aug 23 at 16:08
In that case just make sure that the
CRAFT_BASE_PATH constant in public_html/index.php is pointed at the craft/ folder.â Brandon Kelly
Aug 23 at 16:08
2
2
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
Just updated my answer to show what that would look like.
â Brandon Kelly
Aug 23 at 16:12
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcraftcms.stackexchange.com%2fquestions%2f27417%2fcraft-install-via-composer-install-to-public-html%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password