Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

garynewport's avatar

Issue: Laravel 11 withConsoleKernel() silently fails — Kernel never runs

I’m using Laravel 11.41.3 with the new bootstrap/app.php minimal structure:

return Application::configure(...)->withConsoleKernel(App\Console\Kernel::class)->create();

But App\Console\Kernel::schedule() is never called — not even with dd() or a log file write. Artisan commands like schedule:list silently return nothing. The site itself crashes if .withConsoleKernel(...) is active.

Confirmed: • Kernel class is valid, PSR-4 compliant, autoloadable • No constructor in the Kernel • Manual command calls (e.g. php artisan assessments:check-dates) do work • A FakeKernel that only logs also never gets called

I’ve considered switching to Laravel 10-style bootstrap/app.php with $app->singleton(..., Kernel::class), but haven’t yet — I’d prefer to keep the Laravel 11 minimal structure.

Has anyone seen this? Is there a known fix or deeper requirement?

0 likes
6 replies
amitsolanki24_'s avatar

Please recheck these steps

Ensure you're using withConsoleKernel(App\Console\Kernel::class)

1. Make sure your Kernel class extends Illuminate\Foundation\Console\Kernel
2. Implement the schedule() method with a dummy command or log call
3. Clear and regenerate autoload: composer dump-autoload
4. Test with php artisan schedule:list and schedule:run
garynewport's avatar

Thank you for the reply and sorry for my delay; too much going on!

Anyway...

  1. app/Console/Kernel.php currently contains:
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        dd('schedule() was called');
    }

    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}

So, this is without errors and has the dummy command in place; with the correct use statement at the top.

I then did this:

composer dump-autoload -o

Which gave me this:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

  inertiajs/inertia-laravel ................................................................................................................... DONE
  laravel/fortify ............................................................................................................................. DONE
  laravel/jetstream ........................................................................................................................... DONE
  laravel/sanctum ............................................................................................................................. DONE
  laravel/tinker .............................................................................................................................. DONE
  nesbot/carbon ............................................................................................................................... DONE
  nunomaduro/termwind ......................................................................................................................... DONE
  tightenco/ziggy ............................................................................................................................. DONE

Generated optimized autoload files containing 5375 classes

Followed by this:

php artisan schedule:list

Which returned this:

   INFO  No scheduled tasks have been defined.

And, for the first time, did this:

php artisan schedule:run

and got this:

   INFO  No scheduled commands are ready to run.

I can see that crontabs is running the root cron every minute:

Jun 21 20:24:01 ********: (root) CMD (cd /home/********/laravel/******** && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1)
Jun 21 20:25:01 ********:(root) CMD (cd /home/********/laravel/******** && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1)

And, yes, I just edited those lines with ********; they aren't in the command. :)

So, the cron is being called.

I have checked and the system IS using /usr/local/bin/php and that this is version 8.2.28

Laravel is version 11.41.3

In app.php I have this:

<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use App\Console\Kernel as ConsoleKernel;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \App\Http\Middleware\HandleInertiaRequests::class,
            \Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class,
        ]);

        //
    })
//    ->withConsoleKernel(ConsoleKernel::class)
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

When I introduce the 4th line up (ConsoleKernel) the site crashes.

I believe this is down to the incorrect use statement; that my use is Laravel 10 and I am on Laravel 11.

So, my understanding is (sicne this was built on 10 then factored across to 11)

I should now have use Illuminate\Console\Application as Artisan; use Illuminate\Foundation\Console\Kernel;

make a class change in Kernel.php.

Does this all sound correct?

garynewport's avatar

Just to bring everything up to date, I am now running Laravel 11.44.7

My app.php reads:

Yet with this line uncommented the site crashes:

    ->withConsoleKernel(ConsoleKernel::class)

My Kernel.php now reads:

In the app.php I noted that I had App whilst the directory is app. Since I am on Linux I assumed it might be a case-sensitive issue. However, this did not resolve the issue.

I have cleared caches, etc

If I have that line uncommented and run composer dump-autoload I get this error:

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

But runs clean when uncommented; so I am clearly doing something wrong with this line but unsure what!

garynewport's avatar

@Glukinho

I'm an idiot!

Sorry, didn't even consider the posting of code as an issue!

Never do these things whilst tired.

Glukinho's avatar

If you extend default Illuminate\Foundation\Console\Kernel class, you should have the same constructor and call parent's constructor inside, otherwise Laravel internal magic doesn't execute:

// app/Console/Kernel.php

public function __construct(Application $app, Dispatcher $events)
{
		parent::__construct($app, $events);
}

But I don't understand why you want to have your own console kernel class? Laravel's default one is fine and works out of a box.

You got this structure after upgrading from earlier Laravel versions, right? Laravel introduced new configuration structure since v11, this is about console commands too. Briefly, app\Console\Kernel class shouldn't exist any more and scheduled commands are defined in routes/console.php. I think you should stick to new structure unless you have reasons to have your own.

Please or to participate in this conversation.