无法编写器转储-自动加载-文件放置内容错误



我想:

composer dump-autoload

在Ubuntu 16.04服务器上

我得到错误:

 file_put_contents(/var/www/example.com/site/vendor/composer/autoload_namespaces.php): failed to open stream: Permission denied

:

  1. 修改存储目录权限为755
  2. 确保www-data用户有正确的使用权限

我仍然得到错误。有什么解决办法吗?

首先安装Laravel后,您应该更改某些特定目录的权限。使用以下命令:

// If your project's directory is owned by root then,
sudo chown -R <username> path_to_laravel_project_directory
// Then change these persmissions (from the root of the laravel project directory)
sudo chmod -R 777 storage/
sudo chmod -R 777 bootstrap/cache/
// At the end please generate your project key
php artisan key:generate
// Now you can use
sudo composer dump-autoload

尝试设置这些权限:

sudo chmod -R 755 bootstrap/cache/
sudo chmod -R 755 vendor/composer
sudo chmod -R 755 storage

最新更新