I have an existing Laravel 8 application that is deployed in Google cloud App Engine.
I'm trying to upgrade to Laravel 9, however facing a strange issue while trying to deploy -
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 -
"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
.
In my app.yaml
, runtime of app engine is set to php81
.
Some users had similar error because of storage
directory structure. 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.
storage
- framework
- cache
- data
- sessions
- views
Thanks in advance.
CodePudding user response:
Try setting the runtime to php80
: https://github.com/symfony/symfony/issues/42231
CodePudding user response:
Once you installed the new PHP version did you run composer global update so that you upgrade the global composer dependencies?
You can try running composer self-update and then try running global update.
You may also refer to this GitHub link.