Laravel 5 - PHP致命错误:require():无法打开所需的vendor / autoload.php

时间:2016-01-26 12:02:51

标签: php laravel deployment

我创建了一个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

1 个答案:

答案 0 :(得分:1)

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

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