Answers.Body: <p>The problem I had was caused by the wrong permissions set on some files. The permission settings on my cPanel server are quite different to Craft's suggestions. In my case all folders are 755 and files 644, but with some files that need to writable set at 755.
  Also the permissions for an additional created public_html folder needed to be 750, and this install was in a created subdomain.</p>
  <p>Additionally the index.php file in the web folder needed editing to reflect the location of the bootstrap.php file if you move the web folder in the directory structure.
  The default code is:</p>
  <p><code>require dirname(__DIR__) . '/bootstrap.php';</code></p>
  <p>You need to change this to:</p>
  <p><code>require dirname(__DIR__,1) . '/***/bootstrap.php';</code></p>
  <p>The *** should be replaced by the name of the folder that the bootstrap file is in. The ,1 is how many levels to up in the folder structure from where the index.php is located. In my case the 2 folders are in the same parent folder, so it just need to go up 1 level top find the *** folder.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-29T10:34:35.110Z
Answers.LastActivityDate: 2022-09-29T11:01:22.343Z
Answers.LastEditDate: 2022-09-29T11:01:22.343Z
Answers.UserDisplayName: Paul Frost
Body: <p>I added a new Craft4 install via the command line as per the instrictions.
  Everything went OK and I got &quot;installed Craft successfully&quot;.
  I can run craft update and it returns all up to date.
  The database looks like it's all OK.</p>
  <p>But in the browser I get the 500 error message:
  &quot;The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;
  I haven't moved or renamed the web folder, my directory structure looks like the one on the install document page.
  If I add add a plain text file and call that in the browser it displays OK, so there must be something in the configuration that's wrong.</p>
  <p>My web/index.php file doesn't look like any of my existing craft 3 sites.
  It only has:</p>
  <pre><code>/**
   * Craft web bootstrap file
   */
  
  // Load shared bootstrap
  require dirname(__DIR__) . '/bootstrap.php';
  
  // Load and run Craft
  /** @var craft\web\Application $app */
  $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php';
  $app-&gt;run();
  </code></pre>
  <p>In past I have run with a directory structure of craft and public_html side by side and my index.php file in public_html would have:</p>
  <pre><code>// Define path constants
  define('CRAFT_BASE_PATH', dirname(__DIR__,1).'/craft');
  define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH . '/vendor');```
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T13:51:57.023Z
Comments.Text: Would you check and post the logs? Maybe you see what exactly causes the problem there.
Comments.UserDisplayName: Max Strebel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T16:45:42.410Z
Comments.Text: There is only a console log that is 416 lines and nothing that I can see showing any errors. If I run craft update in the terminal it adds another 63 lines.
  I'm not sure how to "post the logs"?
Comments.UserDisplayName: Paul Frost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T17:06:51.387Z
Comments.Text: Apache should generate error logs that will give you the reason for the 500 server error. Most hosting companies will provide these logs in the project/domain folder (or one level above) or if you're on a dedicated server, they can typically be found in: /var/log/apache2/ or sometimes /etc/apache2/logs
Comments.UserDisplayName: stevecomrie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T17:38:21.123Z
Comments.Text: I'm not seeing anything like that, no apache anywhere. I am using cPanel and this install is on a subdomain.
  I think the problem is connected with the path in the index.php file.
  I'm going to post a separate question about how to install on a subdomain.
Comments.UserDisplayName: Paul Frost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T19:34:22.827Z
Comments.Text: If you do not have a web or phperrors log and console.log does not show any errors, we could look at another place. (the logs. while long and confusing, are always a good place to learn where errors occur. Oftentimes you will see a an error and the detailed error message - for example if php threw an error, a file is missing or a path is wrong)
  
  Is the folder structure default or did you modify it?
Comments.UserDisplayName: Max Strebel
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-28T20:39:47.377Z
Comments.Text: I hadn't modified it, but I've now started a new thread to get more specific about setup in a subdomain. https://craftcms.stackexchange.com/questions/39946/how-to-install-craft-4-on-a-subdomain
Comments.UserDisplayName: Paul Frost
Tags: <installation>
Title: 500 Internal server error after install
ThreadText: # 500 Internal server error after install
  
  (Asked by: username_0 on 2022-09-28)
  
  I added a new Craft4 install via the command line as per the instrictions.
  Everything went OK and I got "installed Craft successfully".
  I can run craft update and it returns all up to date.
  The database looks like it's all OK.
  
  But in the browser I get the 500 error message:
  "The server encountered an internal error or misconfiguration and was unable to complete your request."
  I haven't moved or renamed the web folder, my directory structure looks like the one on the install document page.
  If I add add a plain text file and call that in the browser it displays OK, so there must be something in the configuration that's wrong.
  
  My web/index.php file doesn't look like any of my existing craft 3 sites.
  It only has:
  
  ```
  /**
   * Craft web bootstrap file
   */
  
  // Load shared bootstrap
  require dirname(__DIR__) . '/bootstrap.php';
  
  // Load and run Craft
  /** @var craft\web\Application $app */
  $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php';
  $app->run();
  
  ```
  
  In past I have run with a directory structure of craft and public\_html side by side and my index.php file in public\_html would have:
  
  ```
  // Define path constants
  define('CRAFT_BASE_PATH', dirname(__DIR__,1).'/craft');
  define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH . '/vendor');```
  
  ```
  
  **Tags:** installation
  
  > **Comments:**
  > **username_1**: Would you check and post the logs? Maybe you see what exactly causes the problem there.  
  > **username_0**: There is only a console log that is 416 lines and nothing that I can see showing any errors. If I run craft update in the terminal it adds another 63 lines. I'm not sure how to "post the logs"?  
  > **username_2**: Apache should generate error logs that will give you the reason for the 500 server error. Most hosting companies will provide these logs in the project/domain folder (or one level above) or if you're on a dedicated server, they can typically be found in: /var/log/apache2/ or sometimes /etc/apache2/logs  
  > **username_0**: I'm not seeing anything like that, no apache anywhere. I am using cPanel and this install is on a subdomain. I think the problem is connected with the path in the index.php file. I'm going to post a separate question about how to install on a subdomain.  
  > **username_1**: If you do not have a web or phperrors log and console.log does not show any errors, we could look at another place. (the logs. while long and confusing, are always a good place to learn where errors occur. Oftentimes you will see a an error and the detailed error message - for example if php threw an error, a file is missing or a path is wrong)  Is the folder structure default or did you modify it?  
  > **username_0**: I hadn't modified it, but I've now started a new thread to get more specific about setup in a subdomain. https://craftcms.stackexchange.com/questions/39946/how-to-install-craft-4-on-a-subdomain  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2022-09-29. Score: 1 | Accepted answer
  
  The problem I had was caused by the wrong permissions set on some files. The permission settings on my cPanel server are quite different to Craft's suggestions. In my case all folders are 755 and files 644, but with some files that need to writable set at 755.
  Also the permissions for an additional created public\_html folder needed to be 750, and this install was in a created subdomain.
  
  Additionally the index.php file in the web folder needed editing to reflect the location of the bootstrap.php file if you move the web folder in the directory structure.
  The default code is:
  
  `require dirname(__DIR__) . '/bootstrap.php';`
  
  You need to change this to:
  
  `require dirname(__DIR__,1) . '/***/bootstrap.php';`
  
  The \*\*\* should be replaced by the name of the folder that the bootstrap file is in. The ,1 is how many levels to up in the folder structure from where the index.php is located. In my case the 2 folders are in the same parent folder, so it just need to go up 1 level top find the \*\*\* folder.
  
  
  ---
  
  