【问题标题】:Laravel 5 - PHP Fatal error: require(): Failed opening required vendor/autoload.phpLaravel 5 - PHP 致命错误:require():无法打开所需的 vendor/autoload.php
【发布时间】:2023-04-02 11:06:01
【问题描述】:

我创建了一个 laravel 应用程序,并希望将它部署到一个新环境中。我克隆了我的存储库并运行了“composer install”。我还使用新的数据库设置配置了 .env。当我尝试访问该网站时,出现服务器错误 500。以下错误在 apache error_log 中。

[Tue Jan 26 12:52:24.876800 2016] [:error] [pid 16531] [client xx.xx.xx.xx:12499] PHP Fatal error:  require(): Failed opening required '/var/www/html/bootstrap/../vendor/autoload.php' (include_path='.:/usr/lib/php') in /var/www/html/bootstrap/autoload.php on line 17
[Tue Jan 26 12:55:44.302563 2016] [:error] [pid 16529] [client xx.xx.xx.xx:1615] PHP Warning:  require(/var/www/html/bootstrap/../vendor/autoload.php): failed to open stream: Permission denied in /var/www/html/bootstrap/autoload.php on line 17

任何线索可能是错误的或下一步寻找什么? Composer 更新运行良好:

server:/var/www/html$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files

【问题讨论】:

  • 您是否授予存储文件夹的权限。如果没有,请执行 chmod 777 -fR path/to/storage/folder

标签: php laravel deployment


【解决方案1】:

问题与 apache 用户权限有关。我用以下命令解决了这个问题:

sudo chown www-data:www-data * -R

【讨论】:

    猜你喜欢
    • 2015-04-12
    • 2019-06-07
    • 2016-09-04
    • 2020-04-18
    • 2016-10-20
    • 2020-10-02
    • 2018-03-05
    • 1970-01-01
    • 2021-07-15
    相关资源
    最近更新 更多