Answers.Body: <p>I just updated <a href="https://craftcms.stackexchange.com/a/37299/9">my previous answer</a> on the other Q&amp;A post. (It’s not Craft 4-specific; the newer default project structure was introduced during Craft 3.x.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-05T16:00:51.510Z
Answers.Text: Thanks Brandon. Will see how I get on.
Answers.UserDisplayName: Jonathan Schofield
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-31T13:58:26.117Z
Answers.LastActivityDate: 2023-05-31T13:58:26.117Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>This is related to me asking about <a href="https://craftcms.stackexchange.com/questions/37296/multiple-instances-of-craft-in-same-hosting-account-root">multiple instances of Craft in same hosting account root</a> 2 years ago, but that was for version 3.x, since when <code>bootstrap.php</code> is now part of the Craft infrastructure.</p>
  <p>I need to create a discrete dev environment in the same account as a production instance.</p>
  <p>I can in principle create the following structure*:</p>
  <pre><code>.env &lt;-- points to production DB
  bootstrap.php
  composer.json
  composer.lock
  craft
  config/
  modules/
  storage/
  templates/
  vendor/
  public_html/ &lt;-- production web root
    index.php
  
  dev/
    .env &lt;-- points to dev DB
    bootstrap.php
    composer.json
    composer.lock
    craft
    config/
    modules/
    storage/
    templates/
    vendor/
  dev.domain.com/ &lt;-- dev web root
    index.php
  </code></pre>
  <p>Is it just a case of updating <code>require</code> for <code>bootstrap.php</code> in <code>dev.domain.com/index.php</code> ?</p>
  <p>Or is there a need to <code>define</code> other paths and/or change the <code>craft</code> executable as well?</p>
  <p>(*The above structure is <em>similar</em> to <a href="https://craftcms.stackexchange.com/a/37299/3507">option 2</a> laid out by Brandon 2 years ago, but not the same.)</p>
  <hr />
  <p>I should add that the production instance is already in place so don't really want to alter it!</p>
  
Tags: <installation><multi-environment><hosting>
Title: Craft version 4.x: multiple instances of Craft in same hosting account
ThreadText: # Craft version 4.x: multiple instances of Craft in same hosting account
  
  (Asked by: username_0 on 2023-05-24)
  
  This is related to me asking about [multiple instances of Craft in same hosting account root](https://craftcms.stackexchange.com/questions/37296/multiple-instances-of-craft-in-same-hosting-account-root) 2 years ago, but that was for version 3.x, since when `bootstrap.php` is now part of the Craft infrastructure.
  
  I need to create a discrete dev environment in the same account as a production instance.
  
  I can in principle create the following structure\*:
  
  ```
  .env <-- points to production DB
  bootstrap.php
  composer.json
  composer.lock
  craft
  config/
  modules/
  storage/
  templates/
  vendor/
  public_html/ <-- production web root
    index.php
  
  dev/
    .env <-- points to dev DB
    bootstrap.php
    composer.json
    composer.lock
    craft
    config/
    modules/
    storage/
    templates/
    vendor/
  dev.domain.com/ <-- dev web root
    index.php
  
  ```
  
  Is it just a case of updating `require` for `bootstrap.php` in `dev.domain.com/index.php` ?
  
  Or is there a need to `define` other paths and/or change the `craft` executable as well?
  
  (\*The above structure is *similar* to [option 2](https://craftcms.stackexchange.com/a/37299/3507) laid out by username_1 2 years ago, but not the same.)
  
  ---
  
  I should add that the production instance is already in place so don't really want to alter it!
  
  **Tags:** installation, multi-environment, hosting
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-05-31. Score: 1 | Accepted answer
  
  I just updated [my previous answer](https://craftcms.stackexchange.com/a/37299/9) on the other Q&A post. (It’s not Craft 4-specific; the newer default project structure was introduced during Craft 3.x.)
  
  > **Comments:**
  > **username_0**: Thanks username_1. Will see how I get on.  
  
  ---
  
  