Craft install via composer: install to public_html?

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question



























    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?










    share|improve this question

























      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?










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 23 at 13:49

























      asked Aug 23 at 12:43









      Urs

      2669




      2669




















          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');





          share|improve this answer






















          • But won't that break composer update for later maintenance?
            – Urs
            Aug 23 at 13:48






          • 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











          • 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






          • 2




            Just updated my answer to show what that would look like.
            – Brandon Kelly
            Aug 23 at 16:12










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "563"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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






























          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');





          share|improve this answer






















          • But won't that break composer update for later maintenance?
            – Urs
            Aug 23 at 13:48






          • 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











          • 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






          • 2




            Just updated my answer to show what that would look like.
            – Brandon Kelly
            Aug 23 at 16:12














          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');





          share|improve this answer






















          • But won't that break composer update for later maintenance?
            – Urs
            Aug 23 at 13:48






          • 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











          • 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






          • 2




            Just updated my answer to show what that would look like.
            – Brandon Kelly
            Aug 23 at 16:12












          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');





          share|improve this answer














          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');






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 23 at 16:11

























          answered Aug 23 at 12:56









          Brandon Kelly

          28.6k45106




          28.6k45106











          • But won't that break composer update for later maintenance?
            – Urs
            Aug 23 at 13:48






          • 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











          • 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






          • 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






          • 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











          • 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






          • 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

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Christian Cage

          How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?