Permissions for new folder


  • | 197 points

    Hi All,

    I use a Laravel / Laragon dev area for a project and have installed amazon SPAPI package and have to add a folder to store tokens.

    When I file_get_contents($tokenPath); all I get is a permissions error.

    file_get_contents(C:\laragon\www\core\storage\awsTokens): failed to open stream: Permission denied

    If I run file_get_contents on a file its fine but not on a folder, any ideas as this has me stumped. It work fine on my web server but its jsut Laragon I cant get working.

    Thanks


  • | 2856 points

    AFAIK file_get_contents only works on a file, so this would probably be expected behaviour.


  • | 197 points

    This is a snippet form the package

    public function getToken($key): ?array
    {
    $content = file_get_contents($this->filePath);

    if ($content != '') {
      $json = json_decode($content, true);
      return $json[$key] ?? null;
    }
    return null;
    

    }


  • | 197 points

    I have found the issue.

    Thank-you


  • | 434 points

    Please go to your project root directory and run the following command

    find . -type d -exec chmod 770 {} ; && find . -type f -exec chmod 660 {} ;

    I hope It will solve your issue.
    Feel free to visit download Windows 11


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.