"permission denied" laravel new homestead ubuntu 16.04 - laravel-5

when i run laravel new <new project> i got error like this
PHP Warning: file_put_contents(/home/vagrant/Code/laravel_6c11ebb11f0426f74820afdfb31f24e2.zip): failed to open stream: Permission denied in /home/vagrant/.composer/vendor/laravel/installer/src/NewCommand.php on line 139
i have run sudo chmod -R 777 <name folder> and sudo chown -R vagrant <name folder> but still got the same error.
I try to make new folder with mkdir and i got permission denied. i guessed this about permission problem. but i don't how to solve it

Related

Laravel Project on local Xampp mysql error : file_put_contents: Failed to open stream: Permission denied

I have developed a laravel project on one laptop using local xampp mysql and want to install it on another laptop. I am having this error: file_put_contents(/Applications/XAMPP/xamppfiles/htdocs/sfms/storage/framework/sessions/VS0cObLn8ItoKMt5HQJOlZ0srelpMLsSwm5ZQcPa): Failed to open stream: Permission:
I have tried the following but they did not work:
php artisan cache:clear
php artisan config:clear
manually deleted vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigClearCommand.php
among others.
Please, I need your assistance. Thanks in advance.
you can run this command
sudo chown -R www-data:www-data ./storage ./bootstrap
And then use the command
sudo chmod -R 755 ./storage ./bootstrap
Run this two command for permission.
sudo chmod -R 777 ./storage
sudo chmod -R 777 ./bootstrap
I run the following code in the terminal and it worked for me:
chmod -R 777 storage

Permission denied when running sail up

I've installed laravel 8 and sail, but when I try to run sail up I get this error
vendor/bin/sail: line 14: /home/cerb/projects/timeless-treasures/vendor/laravel/sail/bin/sail: Permission denied
I was running ubuntu on WSL2 and sail up was giving me this permission denied error. You can open your linux/wsl terminal and go one directory up using cd .. then try
chmod -R 777 <project directory name>
this will grant all permissions to your project directory and sail up will start working.

file_put_contents(./composer.lock): failed to open stream: Permission denied Even after running chown command

I am getting this error while installing Laravel latest version on ubuntu 18.04
[ErrorException]
file_put_contents(./composer.lock): failed to open stream: Permission denied
I have even run the following command as suggested by someone in response to the same question
sudo chown -R myuser ~/.composer
Still same error any ideas?
My error was exactly like below after this command: composer update.
[ErrorException]
file_put_contents(./composer.lock): failed to open stream: Permission denied
Solved it only adding sudo command in ubuntu. Full command will be:
sudo composer update
How do you run your php? If it starts when you visit page in browser, then user is www-data and of course there are no permissions.
I think you should try change group of this file:
sudo chgrp www-data ./composer.lock
But I am wondering why do you write into composer lock file? Are you ok?

How to fix Error: laravel.log could not be opened Permission denied?

I'm pretty new at laravel,Actually when i create this command php artisan migration so i face this error how can i resolve this issue thanks.
Error
UnexpectedValueException : The stream or file
"/home/zubair/htdocs/project/storage/logs/laravel.log" could not be opened: failed to open
stream: Permission denied
If you run the command with sudo or chmod -R 755 some of the project's folders, you'll have it working.
sudo chmod -R 755 storage bootstrap/cache
Changing entire project folder's permission is probably not a good idea as your project becomes accessible to any user/script which kind of defeats the purpose of securing it behind root.
change a permission of storage folder
sudo chmod -R 775 /var/www/html/your-project/storage
for more info check this link install laravel in apache

permission denied on database and file on web server

ErrorException (E_WARNING)
file_put_contents(/var/www/html/moha/storage/framework/sessions/rGlwXEnWZF6hnlZY9URsoioiFSjnDsHZyzpbJLiV):
failed to open stream: Permission denied
Try this. This command allows you edit your file in without root permission.
sudo chmod -R 777 /var/www/html/moha/storage/
Your webserver (Apache, Nginx or other) should be able to write on the storage directory. Consider that www-data is the webserver user (default), at root of your project, run the following commands:
sudo chown -R www-data. storage/
sudo chmod -R 777 storage/

Resources