<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>

CC BY-SA 4.0
2022-09-29T10:34:35.110Z
2022-09-29T11:01:22.343Z
2022-09-29T11:01:22.343Z
Paul Frost
<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>

CC BY-SA 4.0
2022-09-28T13:51:57.023Z
Would you check and post the logs? Maybe you see what exactly causes the problem there.
Max Strebel
CC BY-SA 4.0
2022-09-28T16:45:42.410Z
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"?
Paul Frost
CC BY-SA 4.0
2022-09-28T17:06:51.387Z
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
stevecomrie
CC BY-SA 4.0
2022-09-28T17:38:21.123Z
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.
Paul Frost
CC BY-SA 4.0
2022-09-28T19:34:22.827Z
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?
Max Strebel
CC BY-SA 4.0
2022-09-28T20:39:47.377Z
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
Paul Frost
<installation>
500 Internal server error after install
# 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.


---

