3

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? – Simon Kuran Jun 26 '14 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 Jun 27 '14 at 1:05
  • If I just echo out "hello" – eric MC Jun 27 '14 at 13:20
3

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

/craft/..
/public/index.php

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.

.

Example:

If your structure looks like this..

/craft/..
/index.php

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

|improve this answer|||||
  • 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 Jun 26 '14 at 22:09
2

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.

|improve this answer|||||
2

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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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