简体   繁体   English

Laravel 9 部署期间的升级问题

[英]Laravel 9 upgrade issue during deployment

I have an existing Laravel 8 application that is deployed in Google cloud App Engine.我有一个部署在 Google Cloud App Engine 中的现有 Laravel 8 应用程序。

I'm trying to upgrade to Laravel 9, however facing a strange issue while trying to deploy -我正在尝试升级到 Laravel 9,但是在尝试部署时遇到了一个奇怪的问题 -

Updating service [default]...failed.                                                                                                                                                                                                   
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 92fff745-cde1-47d0-b66f-5ec5ac4fc026 status: FAILURE
...n Notice: Return type of Symfony\Component\Finder\Iterator\FileTypeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php:42
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:55
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:71
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:76
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FilterIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/FilterIterator.php:30
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\PathFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/PathFilterIterator.php:27
Class App\Http\Controllers\api\AllApiController located in ./app/Http/Controllers/Api/AllApiController.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
54 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> chmod -R 755 bootstrap/cache
> php artisan config:clear

In Compiler.php line 66:
                                      
  Please provide a valid cache path.  
                                      

Script php artisan config:clear handling the post-install-cmd event returned with error code 1

The error occurs while trying to clear either of route, cache or config.尝试清除路由、缓存或配置时发生错误。 This is the relevant section in composer.json that triggers the error -这是composer.json中触发错误的相关部分 -

"scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],     
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "post-install-cmd": [
            "chmod -R 755 bootstrap\/cache",
            "php artisan config:clear"
            "php artisan route:clear",
            "php artisan cache:clear"
        ]
    }

I have tried to Google but haven't found any relevant answer yet.我试过谷歌,但还没有找到任何相关的答案。 I am not quite sure what is causing this issue and kind of exhausted all the avenues I could think of.我不太确定是什么导致了这个问题,并且用尽了我能想到的所有途径。 Any help on this would be greatly appreciated.对此的任何帮助将不胜感激。

I am upgrading from Laravel 8.0 to 9.11 and PHP 7.2 to 8.0.2 .我正在从 Laravel 8.0升级到9.11和 PHP 7.28.0.2

In my app.yaml , runtime of app engine is set to php81 .在我的app.yaml中,应用引擎的运行时设置为php81

Some users had similar error because of storage directory structure.由于storage目录结构,一些用户有类似的错误。 I have the following directory structure under storage, however I don't think the error is related to this.我在存储下有以下目录结构,但是我认为该错误与此无关。 My directory structure hasn't changed at all, the only change is the upgrade of Laravel and PHP.我的目录结构完全没有变化,唯一的变化是升级了Laravel和PHP。

storage
 - framework
   - cache
      - data
   - sessions
   - views

Thanks in advance.提前致谢。

尝试将运行时设置为php80https ://github.com/symfony/symfony/issues/42231

Once you installed the new PHP version did you run composer global update so that you upgrade the global composer dependencies?安装新的 PHP 版本后,您是否运行了 composer global update 以便升级全局 composer 依赖项?

You can try running composer self-update and then try running global update.您可以尝试运行 composer self-update,然后尝试运行全局更新。

You may also refer to this GitHub link .您也可以参考这个GitHub 链接

@asif - I was wondering if you were able to figure out a solution? @asif - 我想知道您是否能够找到解决方案? In the same boat and from my understanding I might have to downgrade to laravel 8在同一条船上,据我了解,我可能不得不降级到 laravel 8

Please remove comment if not acceptable.如果不能接受,请删除评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM