<p>The main issue is that the <code>require_once CRAFT_VENDOR_PATH.'/autoload.php';</code> fails.</p>
<p>This is because the <code>DIR</code> constant, used to compute the value of <code>CRAFT_BASE_PATH</code> and <code>CRAFT_VENDOR_PATH</code> is undefined.</p>
<p>Try to define the value of the <code>DIR</code> constant so that <code>CRAFT_VENDOR_PATH</code> points to the vendor directory in your Craft project (it hard to help you further without knowing your directory structure).</p>
<p>Once this is done, as Jamie mentions, you must use composer to install Craft dependencies.</p>
<p>Did you make any changes to the index.php file of is it just like it was in the archive you received from the other dev?</p>

CC BY-SA 4.0
2020-09-15T16:46:35.070Z
I edited the index.php because the original developer deleted the settings. I think they were being a pain on purpose. Is the DIR set in a specific location other than index.php?
xecutech
CC BY-SA 4.0
2020-09-15T17:54:58.160Z
I don't think so, I think the important constants are `CRAFT_BASE_PATH` and `CRAFT_VENDOR_PATH`. Can you post the the content of your project root?
nstCactus
CC BY-SA 4.0
2020-09-15T16:30:20.717Z
2020-09-15T16:30:20.717Z
nstCactus
<p>Craft comes with a vendor directory were all your extras and plugins are stored, and the content of it is installed through the composer craft setup, as the contents is stored in your composer.json.</p>
<p>I'd make sure you read this thoroughly: <a href="https://craftcms.com/docs/3.x/installation.html#step-1-download-craft" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/installation.html#step-1-download-craft</a></p>
<p>You can also go to this url to install craft through your browser rather than terminal, try this <code>http://thisisyourwebaddress/index.php?p=admin/install</code></p>
<p>If you've got all the craft files, you will be taken to the install process were you can enter the database details and install craft.</p>

CC BY-SA 4.0
2020-09-15T14:57:39.917Z
Should I run an install over the files that were already installed before the site was moved? I am wondering if I should do a fresh install and then copy the site template files over? I am really stuck with this mess and I may just have to tell the client I can't complete this for them. I appreciate the help.
xecutech
CC BY-SA 4.0
2020-09-15T15:38:52.677Z
I think(If someone who's more knowledgable can correct me) Usually you'd want to just run the install, that and composer install too, it will install everything from your composer.json, from previous experience, after doing this this would usually then show you the error "HTTP 503 – Service Unavailable". which displays on a craft template, which means you need the correct database details
Jamie
CC BY-SA 4.0
2020-09-15T15:53:47.280Z
Also looking at your errors, it looks like the paths in your index.php may be slightly out giving you the errors. Find your autoload.php etc and make sure those paths match up and reflect your project! for example "/home/client//vendor/autoload.php". this has client//vendor with two forward slashes.
Jamie
CC BY-SA 4.0
2020-09-15T15:56:09.007Z
I changed the index.php to correct the double slashes. I am starting to wonder if this may be a folder permission issue.
xecutech
CC BY-SA 4.0
2020-09-15T16:10:14.910Z
Usually it will tell you if it cannot write somewhere. You should refer to this
https://craftcms.com/docs/3.x/installation.html#directory-structure
Lets you know which & where craft needs to write :)
Jamie
CC BY-SA 4.0
2020-09-15T14:35:41.247Z
2020-09-15T14:35:41.247Z
Jamie
<p>I inherited a site running craft and I was asked to move it to my server to host it. The other developer zipped the files and made a database dump for me.</p>
<p>Usually, when I move a site, they have Cpanel access, so I just move and it works with a few tweaks, but they didn't have Cpanel and I am in over my head.</p>
<p>I Know I haven't provided a lot to go on, as I don't know what you need to help me. What is a common thing overlooked? I can post error messages if it helps. The main one I get is the following:</p>
<pre><code>[15-Sep-2020 13:22:01 UTC] PHP Warning:  Use of undefined constant _DIR_ - assumed '_DIR_' (this will throw an Error in a future version of PHP) in /home/client/public_html/index.php on line 7

[15-Sep-2020 13:22:01 UTC] PHP Warning:  require_once(./home/client//vendor/autoload.php): failed to open stream: No such file or directory in /home/client/public_html/index.php on line 11

[15-Sep-2020 13:22:01 UTC] PHP Fatal error:  require_once(): Failed opening required './home/client//vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/client/public_html/index.php on line 11
</code></pre>

CC BY-SA 4.0
2020-09-15T14:01:05.800Z
Could you post the content of your index.php file?
nstCactus
CC BY-SA 4.0
2020-09-15T14:04:25.497Z
<?php
/**
 * Craft web bootstrap file
 */

// Set path constants
define('CRAFT_BASE_PATH', dirname(_DIR_) . '/home/client');
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');

// Load Composer's autoloader
require_once CRAFT_VENDOR_PATH.'/autoload.php';

// Load dotenv?
if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH.'/.env')) {
    Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load();
}

// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';
$app->run();
xecutech
<php><error><installation>
Site moved to new server - Error 500
# Site moved to new server - Error 500

(Asked by: username_0 on 2020-09-15)

I inherited a site running craft and I was asked to move it to my server to host it. The other developer zipped the files and made a database dump for me.
Usually, when I move a site, they have Cpanel access, so I just move and it works with a few tweaks, but they didn't have Cpanel and I am in over my head.
I Know I haven't provided a lot to go on, as I don't know what you need to help me. What is a common thing overlooked? I can post error messages if it helps. The main one I get is the following:
[15-Sep-2020 13:22:01 UTC] PHP Warning:  Use of undefined constant _DIR_ - assumed '_DIR_' (this will throw an Error in a future version of PHP) in /home/client/public_html/index.php on line 7

[15-Sep-2020 13:22:01 UTC] PHP Warning:  require_once(./home/client//vendor/autoload.php): failed to open stream: No such file or directory in /home/client/public_html/index.php on line 11

[15-Sep-2020 13:22:01 UTC] PHP Fatal error:  require_once(): Failed opening required './home/client//vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/client/public_html/index.php on line 11

**Tags:** php, error, installation

> **Comments:**
> **username_1**: Could you post the content of your index.php file?  
> **username_0**: <?php /**  * Craft web bootstrap file  */  // Set path constants define('CRAFT_BASE_PATH', dirname(_DIR_) . '/home/client'); define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');  // Load Composer's autoloader require_once CRAFT_VENDOR_PATH.'/autoload.php';  // Load dotenv? if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH.'/.env')) {     Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load(); }  // Load and run Craft define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();  

---

## 2 answers

### Answer by username_1 on 2020-09-15. Score: 2

The main issue is that the `require_once CRAFT_VENDOR_PATH.'/autoload.php';` fails.

This is because the `DIR` constant, used to compute the value of `CRAFT_BASE_PATH` and `CRAFT_VENDOR_PATH` is undefined.

Try to define the value of the `DIR` constant so that `CRAFT_VENDOR_PATH` points to the vendor directory in your Craft project (it hard to help you further without knowing your directory structure).

Once this is done, as username_2 mentions, you must use composer to install Craft dependencies.

Did you make any changes to the index.php file of is it just like it was in the archive you received from the other dev?

> **Comments:**
> **username_0**: I edited the index.php because the original developer deleted the settings. I think they were being a pain on purpose. Is the DIR set in a specific location other than index.php?  
> **username_1**: I don't think so, I think the important constants are `CRAFT_BASE_PATH` and `CRAFT_VENDOR_PATH`. Can you post the the content of your project root?  

---

### Answer by username_2 on 2020-09-15. Score: 1

Craft comes with a vendor directory were all your extras and plugins are stored, and the content of it is installed through the composer craft setup, as the contents is stored in your composer.json.

I'd make sure you read this thoroughly: <https://craftcms.com/docs/3.x/installation.html#step-1-download-craft>

You can also go to this url to install craft through your browser rather than terminal, try this `http://thisisyourwebaddress/index.php?p=admin/install`

If you've got all the craft files, you will be taken to the install process were you can enter the database details and install craft.

> **Comments:**
> **username_0**: Should I run an install over the files that were already installed before the site was moved? I am wondering if I should do a fresh install and then copy the site template files over? I am really stuck with this mess and I may just have to tell the client I can't complete this for them. I appreciate the help.  
> **username_2**: I think(If someone who's more knowledgable can correct me) Usually you'd want to just run the install, that and composer install too, it will install everything from your composer.json, from previous experience, after doing this this would usually then show you the error "HTTP 503 – Service Unavailable". which displays on a craft template, which means you need the correct database details  
> **username_2**: Also looking at your errors, it looks like the paths in your index.php may be slightly out giving you the errors. Find your autoload.php etc and make sure those paths match up and reflect your project! for example "/home/client//vendor/autoload.php". this has client//vendor with two forward slashes.  
> **username_0**: I changed the index.php to correct the double slashes. I am starting to wonder if this may be a folder permission issue.  
> **username_2**: Usually it will tell you if it cannot write somewhere. You should refer to this https://craftcms.com/docs/3.x/installation.html#directory-structure Lets you know which & where craft needs to write :)  

---

