Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

madushancs's avatar

"mkdir(): Permission denied | Laravel Forge | Digital Ocean ubuntu host

Hello All, I have a problem when deploying Laravel a web application using Laravel forge with digitalocean ubuntu host. I try to generate fake images using faker package. but there is an error. "mkdir(): Permission denied". My image save path should be "/storage/images/products/cover_img". Can anyone help me to solve this problem? This is my first time using cloud hosting. before I used shared hosting cPanel. In cPanel I can give permission using the file manager. but I don't how to do it with cloud hosting. (testing in the localhost, there are no any errors only happening in cloud host) Thank you very much.

0 likes
6 replies
bugsysha's avatar

You are a paying customer. Contact Forge support.

Just out of curiosity, why are you using Faker in production?

1 like
madushancs's avatar

@bugsysha Actually I try to seed some fake product in the subdomain for testing purposes. I think problems in the path can not create without permission. I tried to run this code "sudo chmod 755 -R my path" in web console in digital ocean droplet. Stil could solve. I contacted the forge team about this. they did not give a solution.

cosmeoes's avatar

@madushancs Set the owner to be $USER:www-data as well. Replace $USER with the name of the user you currently own.

sudo chown -R $USER:www-data your/path/

Hopefully that will fix the issue.

1 like
madushancs's avatar

Hello, thanks everybody to help me. Finally, I've figured out the issue, I think First I did the total wrong way because I tried to seed when deploying using forge with php artisan migrate:fresh --seed code. Then came that error. So, I did just deploy with default settings in the forge and I log in to serve using terminal, Then I run the php artisan migrate --seed command and I was successful without any error.

bugsysha's avatar

@madushancs you can use php artisan db:seed to avoid running migrations because if migrations were executed, nothing will be changed.

1 like

Please or to participate in this conversation.