Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:12:18.570Z
Answers.Text: Thanks @brad-bell! That's great idea. Quick question: where should I set up this script?
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:13:02.217Z
Answers.Text: Putin in your public HTML folder, name it "test.php", then load up `yoursite.com/test.php` in a browser.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:14:57.900Z
Answers.Text: Great, thanks for the prompt reply. I will try that now :)
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:26:57.647Z
Answers.Text: 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?
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:31:15.857Z
Answers.Text: Oh wait, i put it in the wrong directory. I'm getting "found it" it now
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:32:31.033Z
Answers.Text: I got the "found it" from the test.php actually haha. No idea why it's saying other for the index.php though.
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:32:33.137Z
Answers.Text: Did you use the full path to `app/index.php` or a relative one like in `$craftPath`?  Try setting `$craftPath` to an absolute path?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:41:37.683Z
Answers.Text: 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.
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T19:42:30.810Z
Answers.Text: Guessing I should run this script: https://github.com/nystudio107/craft-scripts/blob/master/scripts/set_perms.sh ?
Answers.UserDisplayName: Ehsan Tabatabatei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-15T00:33:45.903Z
Answers.Text: That's the one.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T18:44:17.940Z
Answers.LastActivityDate: 2017-04-14T18:44:17.940Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <error-message><server><permissions>
Title: Updated the PHP on server. Getting this error: Please ensure that $craftPath is set correctly
ThreadText: # 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()](https://secure.php.net/manual/en/function.is-file.php) 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
  
  ```
  <?php
  
  if (is_file('path/to/craft/app/index.php')) {
      echo "found it";
  } else {
      echo "oops";
  }
  
  ```
  
  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 @username_1! 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.  
  
  ---
  
  