Thursday, 12 September 2013

permission denied with file_get_contents and file_put_contents on OS X

permission denied with file_get_contents and file_put_contents on OS X

I have a controller (using Symfony) and trying to write a file to a local
machine I have the code is as follows:
$file = '/Users/Aditya/Desktop/insta_user.txt';
$current = file_get_contents($file, FILE_USE_INCLUDE_PATH);
However I am getting an error:
Warning: file_get_contents(/Users/Aditya/Desktop/insta_user.txt): failed
to open stream: Permission denied in
/Users/Aditya/Sites/App/src/App/MainBundle/Controller/InstagramController.php
on line 58
Warning: file_put_contents(/Users/Aditya/Desktop/insta_user.txt): failed
to open stream: Permission denied in
/Users/Aditya/Sites/App/src/App/MainBundle/Controller/InstagramController.php
on line 72
I have chmod 777 to this insta_user.txt. What else do I need to do to make
this work?

No comments:

Post a Comment