简体   繁体   中英

The stream or file “/var/www/alphacomodate/storage/logs/laravel.log” could not be opened in append mode: failed to open stream: Permission denied

Hello i created a linux server on microsoft Azure to host my Laravel application, it works perfectly on my local machine but it doesn't work on the server. I changed the permission to 0755 but nothing seems to be working. i still get the same error. please can someone give me any suggestions or a suitable alternative. Thanks in advance

Do not change octal permission numbers. By default Laravel have setted up that. You need to just give the right ownership for "storage/" folder, and for "bootstrap/cache" folder as well for addition. Like this:

# One-time command for your PC
# give sudo-privileges your current username
sudo usermod -a -G www-data $USER


# Here keep in mind that you need to replace "www-data" to the actual webserver name.
# For some many cases it's the "www-data", but it could be "apache", "httpd" etc for other cases for Apache, or something else
# 
# Setup ownerships/permissions
sudo chown -R $USER:www-data storage/ bootstrap/cache/
sudo chgrp -R www-data storage bootstrap/cache/
sudo chmod -R ug+rwx storage bootstrap/cache/

For detailed explanation read this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM