R
R
Ruslan Serg2019-09-09 18:37:49
linux
Ruslan Serg, 2019-09-09 18:37:49

How to make files created by laravel have the right to be executed?

I have a vds, there is a laravel project there, when working with it, it happens that it seems to create files and itself cannot access them. Error example:

[email protected]:/var/www/[корневая папка сайта]/blog$ php artisan make:migrate
UnexpectedValueException  : The stream or file "/var/www/[корневая папка сайта]/blog/storage/logs/laravel-2019-09-09.log" could not be opened: failed to open stream: Permission denied

And so with all files (mostly with logs). How to make sure that this doesn’t happen :(. And you can advise a book or a resource thread on linux please.
Where [the root folder of the site] is just the name of my site, I hid it in such a way that no outsider came in.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
planc, 2019-09-09
@planc

1) install sudo
2) create a file /etc/sudoers.d/your_user_name
3) with the following content:
4) now you can execute commands on behalf of a user who has write permissions:
https://wiki.gentoo.org/wiki/Sudo/ru
5) to simplify, you can add to ~/.bashrc
alias phpsudo="sudo -u user_name_of_php_run_php"
now you can use the phpsudo command instead of sudo -u user_name_of_php_run_php"
5 point won't work until you relog to the server or run source ~/.bashrc

D
Dmitry, 2019-09-10
@slo_nik

Good morning.
Are you having this problem on your local computer?
If yes, then maybe this question of mine will help you with the solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question