【问题标题】:The stream or file "/var/www/alphacomodate/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied无法以附加模式打开流或文件“/var/www/alphacommodate/storage/logs/laravel.log”:无法打开流:权限被拒绝
【发布时间】:2021-06-26 10:01:28
【问题描述】:

您好,我在 microsoft Azure 上创建了一个 linux 服务器来托管我的 Laravel 应用程序,它在我的本地计算机上完美运行,但在服务器上却无法运行。我将权限更改为 0755,但似乎没有任何效果。我仍然得到同样的错误。请有人给我任何建议或合适的替代方案。 提前致谢

【问题讨论】:

  • sudo chmod -R 775 storage 如果仍然无法正常工作,那么您需要将所有权授予php-fpm

标签: php linux laravel azure web-hosting


【解决方案1】:

不要更改八进制权限编号。默认情况下,Laravel 已经设置好了。您只需为“storage/”文件夹和“bootstrap/cache”文件夹以及添加提供正确的所有权。像这样:

# 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/

详细解释请阅读this

【讨论】:

    猜你喜欢
    • 2021-10-03
    • 2021-10-03
    • 2018-05-06
    • 2018-10-03
    • 2020-06-16
    • 2018-07-08
    • 2021-11-15
    • 2022-11-30
    • 2021-02-09
    相关资源
    最近更新 更多