我在创建cronjob时遇到了一些问题Elastic Beanstalk在本地环境中一切正常(我'm using homestead) I' ve创建了一个工匠命令并使其运行时间表
我尝试在服务器上运行 php artisan cancel:request ,我得到了:

无法打开流或文件“/var/app/current/storage/logs/laravel-2018-01-23.log”:无法打开流:权限被拒绝

谷歌搜索几个小时后,我找到了解决问题的解决方案 .

01: `sudo chown -R ec2-user /var/www/html/`
02: `sudo chmod -R 775 /var/www/html/storage/`
03: `sudo chmod -R 775 /var/www/html/bootstrap/cache/`

我将能够再次运行 php artisan cancel:request 但是当我部署新版本的应用程序时 . 问题再次出现 . 以前有人有这个问题吗?请帮忙 . 我've also tried to create a config file to automatically run these commands on server. But it also doesn'工作 . 这是我在environment.config中的内容

commands:
  00_composer_update:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update

option_settings:
  - namespace: aws:elasticbeanstalk:application:environment
    option_name: COMPOSER_HOME
    value: /root

container_commands:
  03_set_owner_of_project_directory:
    command: "sudo chown -R ec2-user /var/www/html/"
  04_give_access_to_storage_folder:
    command: "sudo chmod -R 775 /var/www/html/storage/"
  05_give_access_to_storage_cache_folder:
    command: "sudo chmod -R 775 /var/www/html/bootstrap/cache/"```