laravel 5 maintenance page broken during composer

2019-09-11 07:16发布

问题:

When I update my laravel 5 app with php artisan down && composer update, the maintenance page does not show up, but an error appears. (whoops, something went wrong...)

The log has this error:

production.ERROR: exception 'ErrorException' with message 'file_put_contents(/var/www/app/vendor/services.json): 
failed to open stream: Permission denied' in /var/www/app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:74

After the update, the maintenance page works again. When I look into the vendor directory I see this:

drwxr-xr-x  3 hannes http    4096  4. Feb 17:40 psr
drwxr-xr-x  3 hannes http    4096 17. Mär 18:20 psy
drwxr-xr-x  9 hannes hannes  4096 22. Mär 10:42 sebastian
-rw-r--r--  1 hannes hannes 10297 22. Mär 10:44 services.json
drwxr-xr-x  3 hannes http    4096 14. Mär 17:32 swiftmailer
drwxr-xr-x 15 hannes http    4096 22. Mär 10:42 symfony

The services.json does not have http as group.

Here is the scripts part of my composer.json:

    "scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-create-project-cmd": [
        "php -r \"copy('.env.example', '.env');\"",
        "php artisan key:generate"
    ]
    }

What could I do to ensure that my maintenance page is always working during the composer update? I don't understand what is happening there.