Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Vimeo Upload Error with Laragon "file_put_contents(): write of 211 bytes failed with errno=13 Permission denied" #91

Open
welland-creative opened this issue Feb 25, 2022 · 5 comments

Comments

@welland-creative
Copy link

Hi, I'm developing a website that uploads videos to Vimeo using this package while using Laragon for local development (which has been working well).

However recently I have been getting this error when trying to upload the videos.

ErrorException
file_put_contents(): write of 211 bytes failed with errno=13 Permission denied

I've tried:

  • Reinstalling Laragon

  • All php artisan / composer commands you could possibly think of to clear any caches (including entirely reinstalling the vendor folder).

  • Granting permissions to various folders using chmod -R 755 and on folders on my windows pc

  • Getting new API keys for Vimeo

  • Reading a lot of forums, stack overflow and GitHub issue pages

I'm genuinely struggling to find a way to resolve this issue and would appreciate some help?

I appreciate this was recently mentioned in another issue on here #87 but I've been looking for quite some time for a solution and this is happening for a lot of people which leads me to believe this is an issue with the package.

@aaronm67
Copy link
Collaborator

aaronm67 commented Feb 25, 2022

This is a permissions issue with the user running your web app. Tus uploads default to ./vendor/ankitpokhrel/tus-php/.cache within the webroot - this means, on the default configuration, the user running your app needs write permission to this directory. On some webservers, this is not the default configuration.

There are some examples in the main PHP library of configuration where you specify a custom Cache directory, https://github.com/vimeo/vimeo.php/blob/master/example/upload_custom_cache.php, you can use a custom VimeoFactory when using this class to apply a similar configuration.

@welland-creative
Copy link
Author

Thank you for your response.

I don't understand how to grant permissions to ./vendor/ankitpokhrel/tus-php/.cache (I've tried to do this using the windows "properties" option and this hasn't worked).

I can't figure out the username ruining the web app and even if I had that username I won't know how to use it to set the permissions for that file.

Thank you for providing that link as an example but I don't know from that how to use a custom cache directory, where that would live or what that even means really?

Your package was working perfectly for me and then all of a sudden it had this error and now it's not working and I've been trying for weeks now to get this working and it's incredibly frustrating and I'm ruining out of options I've tried so many things to solve this and nothing is working.

This is for a really important project for me and I'm worried I won't be able to solve this.

If you can offer any further help or guidance I'd really appreciate it?

@aaronm67
Copy link
Collaborator

On Windows, get_current_user() in PHP will return the username of the user running the application, in most cases it'll be some sort of system account.

The CLI tool for permissions in windows is icacls, you want something like

icalcs C:/your_app/vendor/ankitpohrel/tus-php/.cache /grant THE_USER_NAME:M

To set a custom cache directory, you would create a Factory that returns a Vimeo object, similar to what Vimeo Factory does, except using a custom cache directory like in the example

@sajjawal
Copy link

sajjawal commented Jul 5, 2022

file_put_contents(): Write of 211 bytes failed with errno=13 Permission denied
someone please help how we resolve this error its is very urgent please help me i dont locate the file where it is

@isaacdarcilla
Copy link

In my case in an Ubuntu server, ankitpohrel/tus-php has no permission to create .cache folder and throwing mkdir(): Permission denied.

What I did was to manually create .cache folder in ankitpohrel/tus-php and grant a 777 permission to ./vendor/ankitpokhrel/tus-php/.cache.

cd /vendor/ankitpokhrel/tus-php
ls -l -a

total 36
drwxr-xr-x. 5 ec2-user ec2-user   139 Sep 12 23:53 .
drwxr-xr-x. 3 ec2-user ec2-user    21 Sep 11 00:06 ..
drwxrwxrwx. 2 ec2-user ec2-user    34 Sep 12 23:55 .cache
-rw-r--r--. 1 ec2-user ec2-user   445 Sep 18  2022 .php-cs-fixer.php
-rw-r--r--. 1 ec2-user ec2-user  1080 Sep 18  2022 LICENSE
-rw-r--r--. 1 ec2-user ec2-user 17786 Sep 18  2022 README.md
-rw-r--r--. 1 ec2-user ec2-user   404 Sep 18  2022 SECURITY.md
drwxr-xr-x. 2 ec2-user ec2-user    17 Sep 18  2022 bin
-rw-r--r--. 1 ec2-user ec2-user  1320 Sep 18  2022 composer.json
drwxr-xr-x. 9 ec2-user ec2-user   182 Sep 18  2022 src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants