<p>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 <code>app</code> folder inside the <code>craft</code> folder as well.</p>

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

CC BY-SA 4.0
2019-09-14T03:48:57.720Z
This second remark. If you are deploying with git (like I am, on Forge) of course this will happen.
David Rhoden
CC BY-SA 3.0
2017-10-31T20:31:35.350Z
2017-10-31T20:31:35.350Z
Ian
<p>Then, set the correct permissions on the document root and Craft files and directories within:</p>

<p>chown -R www-data:www-data /var/www</p>

<p>chmod -R 770 /var/www</p>

<p>chmod -R 775 /var/www/craft</p>

<p>chmod -R 775 /var/www/html</p>

<p>chmod 774 /var/www/craft/app</p>

<p>chmod 774 /var/www/craft/config</p>

<p>chmod 774 /var/www/craft/storage</p>

CC BY-SA 3.0
2017-05-16T08:35:01.767Z
2017-05-16T08:35:01.767Z
sachin james
<p>You can set the proper permissions for the Craft install via:</p>

<p><a href="https://github.com/nystudio107/craft-scripts" rel="nofollow noreferrer">https://github.com/nystudio107/craft-scripts</a></p>

CC BY-SA 3.0
2017-04-14T01:50:40.570Z
2017-04-14T01:50:40.570Z
andrew.welch
<p>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 <code>craft</code> folder) or your php.ini file has  <a href="http://php.net/manual/en/ini.core.php#ini.open-basedir">open_basedir</a> restrictions in place preventing PHP from accessing the folder.</p>

CC BY-SA 3.0
2014-09-17T02:49:24.573Z
Ok, thanks Brad. Will double check these things.
markstewie
CC BY-SA 3.0
2014-09-17T02:53:15.770Z
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
CC BY-SA 3.0
2014-09-17T02:54:11.563Z
What are the permissions on the folder and who's the user:group owner?
Brad Bell
CC BY-SA 3.0
2014-09-17T03:00:28.150Z
Looks like 775 permission on the folder.. and I'm the owner https://www.dropbox.com/s/k3a47rq1jniszcd/Screenshot%202014-09-17%2014.59.13.png?dl=0
markstewie
CC BY-SA 3.0
2014-09-17T03:03:03.593Z
What's the user:group Apache is running as? http://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as
Brad Bell
CC BY-SA 3.0
2014-09-17T03:07:12.563Z
Ran this `ps aux | egrep '(apache|httpd)'` and got this -> https://www.dropbox.com/s/2n0h35jsp61t8ob/Screenshot%202014-09-17%2015.06.23.png?dl=0. Doesn't make a lot of sense to me but if you can make anything out that would be great. Really appreciate your help!!
markstewie
CC BY-SA 3.0
2014-09-17T03:10:34.867Z
When I run `ps axo user,group,comm | grep apache` I get this https://www.dropbox.com/s/oj7ioyr36plxz6b/Screenshot%202014-09-17%2015.10.08.png?dl=0. So looks like it's running as `root`.. right?
markstewie
CC BY-SA 3.0
2014-09-17T03:12:40.007Z
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
CC BY-SA 3.0
2014-09-17T03:14:02.853Z
Yep.. that's it. Got it working running `sudo chown -R www-data:www-data htdocs`. Thanks for your help man!
markstewie
CC BY-SA 3.0
2014-09-17T03:15:00.090Z
No problem! Now all you have to do is mark this as the answer. :)
Brad Bell
CC BY-SA 3.0
2014-09-17T02:40:35.713Z
2014-09-17T02:40:35.713Z
Brad Bell
<p>Trying to get my Craft site running on my server for the first time.</p>

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

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

<p>What can I try to get this working? </p>

<install><server>
Getting $craftPath error on server trying to get Craft running
# Getting $craftPath error on server trying to get Craft running

(Asked by: username_0 on 2014-09-17)

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?

**Tags:** install, server

---

## 4 answers

### Answer by username_5 on 2014-09-17. Score: 8 | Accepted answer

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](http://php.net/manual/en/ini.core.php#ini.open-basedir) restrictions in place preventing PHP from accessing the folder.

> **Comments:**
> **username_0**: Ok, thanks Brad. Will double check these things.  
> **username_0**: 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?  
> **username_5**: What are the permissions on the folder and who's the user:group owner?  
> **username_0**: Looks like 775 permission on the folder.. and I'm the owner https://www.dropbox.com/s/k3a47rq1jniszcd/Screenshot%202014-09-17%2014.59.13.png?dl=0  
> **username_5**: What's the user:group Apache is running as? http://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as  
> **username_0**: Ran this `ps aux | egrep '(apache|httpd)'` and got this -> https://www.dropbox.com/s/2n0h35jsp61t8ob/Screenshot%202014-09-17%2015.06.23.png?dl=0. Doesn't make a lot of sense to me but if you can make anything out that would be great. Really appreciate your help!!  
> **username_0**: When I run `ps axo user,group,comm | grep apache` I get this https://www.dropbox.com/s/oj7ioyr36plxz6b/Screenshot%202014-09-17%2015.10.08.png?dl=0. So looks like it's running as `root`.. right?  
> **username_5**: 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.  
> **username_0**: Yep.. that's it. Got it working running `sudo chown -R www-data:www-data htdocs`. Thanks for your help man!  
> **username_5**: No problem! Now all you have to do is mark this as the answer. :)  

---

### Answer by username_1 on 2017-10-31. Score: 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.

> **Comments:**
> **username_2**: This second remark. If you are deploying with git (like I am, on Forge) of course this will happen.  

---

### Answer by username_3 on 2017-05-16. Score: 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


---

### Answer by username_4 on 2017-04-14. Score: 1

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

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


---

