9

Trying to get my Craft site running on my server for the first time.

Getting the error Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/dev.mysite.com/htdocs/public/index.php

However, there is nothing different to the folder structure on my server than I have locally. i.e. the $craftPath set in index.php is still ../craft which is correct... my Craft folder sits beside my public folder as per default installation.

What can I try to get this working?

4 Answers 4

8

9 times out of 10, if you're absolutely sure the path is correct, it's either a permissions issue (PHP doesn't have permissions to open the craft folder) or your php.ini file has open_basedir restrictions in place preventing PHP from accessing the folder.

10
  • Ok, thanks Brad. Will double check these things.
    – markstewie
    Commented Sep 17, 2014 at 2:49
  • It's not open_basedir... just checked php.ini and it's commented out. How would I ensure or check if php has permissions to open the craft folder?
    – markstewie
    Commented Sep 17, 2014 at 2:53
  • What are the permissions on the folder and who's the user:group owner?
    – Brad Bell
    Commented Sep 17, 2014 at 2:54
  • 1
    What's the user:group Apache is running as? serverfault.com/questions/125865/…
    – Brad Bell
    Commented Sep 17, 2014 at 3:03
  • 1
    Hrm... looks like it's running as www-data. If you chance the permissions of the craft folder to 777 and it starts working, then that means www-data doesn't have write permissions. You can chmod -R www-data:www-data the craft folder and you should still be able to run with 775.
    – Brad Bell
    Commented Sep 17, 2014 at 3:12
4

If your permissions are set correctly, your php.ini is all correct, your craft folder exists and everything seems like it should work fine... Make sure you have the app folder inside the craft folder as well.

You'll get the "Could not find your craft/ folder." if there is no app folder.

1
  • This second remark. If you are deploying with git (like I am, on Forge) of course this will happen. Commented Sep 14, 2019 at 3:48
1

You can set the proper permissions for the Craft install via:

https://github.com/nystudio107/craft-scripts

1

Then, set the correct permissions on the document root and Craft files and directories within:

chown -R www-data:www-data /var/www

chmod -R 770 /var/www

chmod -R 775 /var/www/craft

chmod -R 775 /var/www/html

chmod 774 /var/www/craft/app

chmod 774 /var/www/craft/config

chmod 774 /var/www/craft/storage

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.