I have a Craft site that works great locally, but I can't get it running on a staging server. The virtual host is working and when I remove code from index.php in html it runs perfectly. Here is the error...

Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/vhosts/testsite/staging/html/index.php

I've seen the error reported online but no solutions, any ideas?

  • What is $craftPath set to in index.php? Where is your Craft folder relative to web root? Commented Jun 26, 2014 at 21:55
  • @EricCallan What do you mean when you say that you "remove code from index.php in html and it runs perfectly"? That flat files and anything not referencing the Craft folder behave normally?
    – Matt Stein
    Commented Jun 27, 2014 at 1:05
  • If I just echo out "hello"
    – eric MC
    Commented Jun 27, 2014 at 13:20

3 Answers 3


If you upload Craft, your folder structure should look like this (default):


If this is not the case, you have to set $craftPath (in the index.php) depending on your folder structure. Check out the Installing section in the docs.



If your structure looks like this..


..the path should be: $craftPath = './craft';

  • 6
    We've also seen this happen, even if everything appears to be setup correctly, because the host has some PHP open_basedir restrictions in place that won't allow Craft to find the craft/ folder.
    – Brad Bell
    Commented Jun 26, 2014 at 22:09

I had this issue on my VPS and found out it was due to permissions. I had to chown the craft folder to the Apache group (for Ubuntu, its www-data):

sudo chown -R sudo_user:www-data /var/www/craft

Replace "sudo_user" with your user, and /var/www/craft to the full path of your craft folder.


Just wanted to add on to Brian's post about permissions, for future users who are having a similar issue and stumble across this answer. I was running into similar problems locally using MAMP, and found the Apache group for OS X is _www. Once I did the command

sudo chown -R sudo_user:_www /Sites/craft

everything loaded as expected. Obviously the "Sites/craft" directory is my own path. Yours will probably be different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.