<p>All Craft is doing is using PHP's <a href="https://secure.php.net/manual/en/function.is-file.php" rel="nofollow noreferrer">is_file()</a> method to check if the supplied path to <code>craft/app/index.php</code> returns true or not.</p>

<p>Take Craft out of the picture and setup a simple PHP script that does </p>

<pre><code>&lt;?php

if (is_file('path/to/craft/app/index.php')) {
    echo "found it";
} else {
    echo "oops";
}
</code></pre>

<p>If you get an "oops", then there is some environmental issue (PHP permissions, open_basedir restrictions, Suhosin, mod_security, etc.) that is preventing PHP from finding that file that will need to be addressed.</p>

<p>If it is permissions related (the most common cause), there is a handy script here that will properly set the permissions for a Craft install: <a href="https://github.com/nystudio107/craft-scripts/tree/master/scripts" rel="nofollow noreferrer">https://github.com/nystudio107/craft-scripts/tree/master/scripts</a></p>

CC BY-SA 3.0
2017-04-14T19:12:18.570Z
Thanks @brad-bell! That's great idea. Quick question: where should I set up this script?
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:13:02.217Z
Putin in your public HTML folder, name it "test.php", then load up `yoursite.com/test.php` in a browser.
Brad Bell
CC BY-SA 3.0
2017-04-14T19:14:57.900Z
Great, thanks for the prompt reply. I will try that now :)
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:26:57.647Z
Unfortunately, even if I navigate to /test.php after I placed it in the public folder, it still spits out "Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/html/production/public/index.php"

I tried a var_dump of the $path as a sanity check and it did spit out the right path to the index of the app. I'm guessing it's likely a permission issue right?
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:31:15.857Z
Oh wait, i put it in the wrong directory. I'm getting "found it" it now
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:32:31.033Z
I got the "found it" from the test.php actually haha. No idea why it's saying other for the index.php though.
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:32:33.137Z
Did you use the full path to `app/index.php` or a relative one like in `$craftPath`?  Try setting `$craftPath` to an absolute path?
Brad Bell
CC BY-SA 3.0
2017-04-14T19:41:37.683Z
Yeah I used the absolute path "../craft/app/index.php" inside my test.php file and it spit out oops. It's obviously there so it seems like it doesn't have permission to access.
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-14T19:42:30.810Z
Guessing I should run this script: https://github.com/nystudio107/craft-scripts/blob/master/scripts/set_perms.sh ?
Ehsan Tabatabatei
CC BY-SA 3.0
2017-04-15T00:33:45.903Z
That's the one.
Brad Bell
CC BY-SA 3.0
2017-04-14T18:44:17.940Z
2017-04-14T18:44:17.940Z
Brad Bell
<p>I am running Amazon Ec2 instance and tried updating the PHP on the site using this guide: <a href="http://brianshim.com/webtricks/update-amazon-ami-php5-3-to-php5-4/" rel="nofollow noreferrer">http://brianshim.com/webtricks/update-amazon-ami-php5-3-to-php5-4/</a></p>

<p>And now this is the error I am receiving:
Please ensure that $craftPath is set correctly in /var/www/html/staging/public/index.php</p>

<p>I tried resetting the permissions, and restored the old http config files, to no avail. I have no idea what it could be. I checked php.ini for open_basedir and did not find it. </p>

<p>Could it be the permissions? </p>

<error-message><server><permissions>
Updated the PHP on server. Getting this error: Please ensure that $craftPath is set correctly
# Updated the PHP on server. Getting this error: Please ensure that $craftPath is set correctly

(Asked by: username_0 on 2017-04-14)

I am running Amazon Ec2 instance and tried updating the PHP on the site using this guide: <http://brianshim.com/webtricks/update-amazon-ami-php5-3-to-php5-4/>

And now this is the error I am receiving:
Please ensure that $craftPath is set correctly in /var/www/html/staging/public/index.php

I tried resetting the permissions, and restored the old http config files, to no avail. I have no idea what it could be. I checked php.ini for open\_basedir and did not find it.

Could it be the permissions?

**Tags:** error-message, server, permissions


---

## 1 answers

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

All Craft is doing is using PHP's is_file() method to check if the supplied path to craft/app/index.php returns true or not.
Take Craft out of the picture and setup a simple PHP script that does 

If you get an "oops", then there is some environmental issue (PHP permissions, open_basedir restrictions, Suhosin, mod_security, etc.) that is preventing PHP from finding that file that will need to be addressed.
If it is permissions related (the most common cause), there is a handy script here that will properly set the permissions for a Craft install: https://github.com/nystudio107/craft-scripts/tree/master/scripts

> **Comments:**
> **username_0**: Thanks @brad-bell! That's great idea. Quick question: where should I set up this script?  
> **username_1**: Putin in your public HTML folder, name it "test.php", then load up `yoursite.com/test.php` in a browser.  
> **username_0**: Great, thanks for the prompt reply. I will try that now :)  
> **username_0**: Unfortunately, even if I navigate to /test.php after I placed it in the public folder, it still spits out "Could not find your craft/ folder. Please ensure that $craftPath is set correctly in /var/www/html/production/public/index.php"  I tried a var_dump of the $path as a sanity check and it did spit out the right path to the index of the app. I'm guessing it's likely a permission issue right?  
> **username_0**: Oh wait, i put it in the wrong directory. I'm getting "found it" it now  
> **username_0**: I got the "found it" from the test.php actually haha. No idea why it's saying other for the index.php though.  
> **username_1**: Did you use the full path to `app/index.php` or a relative one like in `$craftPath`?  Try setting `$craftPath` to an absolute path?  
> **username_0**: Yeah I used the absolute path "../craft/app/index.php" inside my test.php file and it spit out oops. It's obviously there so it seems like it doesn't have permission to access.  
> **username_0**: Guessing I should run this script: https://github.com/nystudio107/craft-scripts/blob/master/scripts/set_perms.sh ?  
> **username_1**: That's the one.  

---

