Broken v4 trying to migrate to v5

I am in a world of hurt here, please help. I tried to run through the migration process from v4 to v5 (after finally getting v5 up and running on the same machine). When it failed with a 500 error I followed the troubleshooting instructions to add EXPANDED_LOGGING=true to the .env file in my v4 install. It made no difference, so then I cd to that folder and ran php7.3 artisan optimize and get the following errors:

root@myhost:/var/www/mysite# php7.3 artisan optimize
PHP Warning:  Class 'Google_Service' not found in /var/www/mysite/vendor/google/apiclient-services/autoload.php on line 21
PHP Warning:  Class 'Google_Service_Resource' not found in /var/www/mysite/vendor/google/apiclient-services/autoload.php on line 21
PHP Warning:  Class 'Google_Model' not found in /var/www/mysite/vendor/google/apiclient-services/autoload.php on line 21
PHP Warning:  Class 'Google_Collection' not found in /var/www/mysite/vendor/google/apiclient-services/autoload.php on line 21

In routes.php line 15:
Erroneous data format for unserializing 'Symfony\Component\Routing\CompiledRoute'

And now, even my v4 site, which was working perfectly up to now, will not load AT ALL.

I got rid of the php warnings (by commenting out those lines in that file), but still have the Erroneous data format error that I can’t get rid of and my v4 site is completely offline.

Well, I deleted the cache folder and recreated it, but still either get the following:

There appears to be a problem with your configuration, please check your .env file.

If you've run 'php artisan config:cache' you will need to run 'php artisan config:clear'
.

or if I turn on debug, I get:

Use of undefined constant NINJA_VERSION - assumed 'NINJA_VERSION' (this will throw an Error in a future version of PHP)

So, I am still stuck with no working v4 :confused:

next thing I tried was changing php version on that site from 7.3 to 7.4, but I have the exact same errors, even though php7.4 artisan optimize, php7.4 artisan config:cache and php7.4 artisan config:clear command all run without errors.

Is there some other command I can run to get my install up and running again? It was stable for over 2 years and I am really regretting trying to upgrade now.

my next hope is to simply overwrite ALL my files with a backup I made yesterday. Fingers crossed…

while I am waiting for those files to restore, here is what the laravel-error.log says and apparently is getting tripped up on:


[2021-11-22T13:22:50.740925+00:00] production.ERROR: ***ErrorException*** [0] : /var/www/mysite/app/Http/Middleware/StartupCheck.php [Line 73] => Use of undefined constant NINJA_VERSION - assumed 'NINJA_VERSION' (this will throw an Error in a future version of PHP)  {"context":"PHP","user_id":0,"account_id":0,"user_name":"","method":"GET","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15","locale":"en","ip":"xx.xx.xx.xx","count":9,"is_console":"no","is_api":"no","db_server":"mysql","url":"/"} []
[2021-11-22T13:22:50.741132+00:00] production.ERROR: [stacktrace] 2021-11-22 01:22:50 Use of undefined constant NINJA_VERSION - assumed 'NINJA_VERSION' (this will throw an Error in a future version of PHP): #0 /var/www/mysite/app/Http/Middleware/StartupCheck.php(73): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\StartupCheck->handle() #2 /var/www/mysite/app/Http/Middleware/QueryLogging.php(32): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #3 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\QueryLogging->handle() #4 /var/www/mysite/app/Http/Middleware/DuplicateSubmissionCheck.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #5 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\DuplicateSubmissionCheck->handle() #6 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #7 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() #8 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #9 /var/www/mysite/app/Http/Middleware/VerifyCsrfToken.php(44): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle() #10 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\VerifyCsrfToken->handle() #11 /var/www/mysite/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #12 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle() #13 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #14 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle() #15 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #16 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() #17 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #18 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle() #19 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #20 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then() #21 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack() #22 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute() #23 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute() #24 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch() #25 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}() #26 /var/www/mysite/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #27 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle() #28 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #29 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() #30 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #31 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then() #32 /var/www/mysite/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() #33 /var/www/mysite/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle() #34 {main}    {"context":"PHP","user_id":0,"account_id":0,"user_name":"","method":"GET","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15","locale":"en","ip":"xx.xx.xx.xx","count":10,"is_console":"no","is_api":"no","db_server":"mysql","url":"/"} []

Well that didn’t work. But the error is at least different. “Whoops, looks like something went wrong.”…Any other bright ideas? Here is the new error:

(1/1) ErrorException

unserialize(): Error at offset 0 of 81 bytes

Can ANYONE recommend ANYTHING to get my v4 install back up and running? Even a restore of all the files and the DB failed. :confused: starting to get desperate…

  • I have a backup of the entire web folder from a time it was working
  • I have a backup of the db from when it was working
  • I have verified my nginx config is exactly the same
  • I have rebooted the machine, restarted nginx, restarted everything

Why is there no way to restore v4 to working order??

JFC I found a fix. After trying EVERY artisan command ONE by painful ONE, this command brought my site back to working order:
php7.3 artisan route:clear

FFS.

2 Likes

Same issue after update I needed to modify to php artisan route:clear