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?

| improve this question | | | | |
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.

| improve this answer | | | | |
  • Ok, thanks Brad. Will double check these things. – markstewie Sep 17 '14 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 Sep 17 '14 at 2:53
  • What are the permissions on the folder and who's the user:group owner? – Brad Bell Sep 17 '14 at 2:54
  • 1
    What's the user:group Apache is running as? serverfault.com/questions/125865/… – Brad Bell Sep 17 '14 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 Sep 17 '14 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.

| improve this answer | | | | |
  • This second remark. If you are deploying with git (like I am, on Forge) of course this will happen. – David Rhoden Sep 14 '19 at 3:48
1

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

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

| improve this answer | | | | |
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

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