Look in the Laravel Log files for the error.
You have something in a service provider that is preventing the laravel framework from starting.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everyone. I am facing an unexpected problem. My project was working fine but suddenly artisan command stopped working. Then I googled and tried the following:
composer dumpautoload
composer update
php artisan optimize
But nothing worked. If I run only php artisan it freezes and does not show any error. I noticed whenever I tried to update composer the error occured when
@php artisan package:discover
start compiling and it freezes. I guessed mybe custom command caused this error so I removed those command. After that If I run
php artisan:list
Could not open input file: artisan:list
I really stuck here. Need help. I am using laravel 5.5.
Look in the Laravel Log files for the error.
You have something in a service provider that is preventing the laravel framework from starting.
@snapey thank you for your reply. My project is running perfectly except no artisan command is working. And I have seen in the laravel log file but there is no error in current date.
php artisan:list
Could not open input file: artisan:list
@nnnayeem This may not be your issue, but you are not running artisan correctly. That is not a framework error, but a PHP error. It is trying to open the file artisan:list, which obviously does not exist. What you want to run instead is: php artisan list
I ran php artisan list too. But still is not working. It freezes and does no show any errors. What I don't understand is why suddenly happened this. My project was running perfectly. My other project is running too. No artisan error.
@talinon could you give any direction?
I figured it wasn't the root of the issue. I just didn't want you to keep running the same erroneous command and not get anywhere :)
Try running it in verbose mode and see if it says anything?
php artisan list -vvv
@talinon it did not work.
What php version are you running on the command line ?php -v
I am running php 7.2.10
is that what php -v says, or what you think?
Since this happened since you tried to discover packages, I would think it would be a service provider for one of those packages. You wouldn't happen to have a versioned file of your composer.lock before running the command would you?
If not, you could do some trial error and disable package discovery:
Add this within composer.json:
"extra": {
"laravel": {
"dont-discover": [
"*"
]
}
},
and then run composer update and see if artisan works?
im thinking that if there is nothing in the logfile it might be because your user cannot write to the file.
What operating system is it?
Try deleting the logfile completely and then try again
@snapey, I ran php -v and gave me the php version. I also deleted the lof file and no new log was added later to the log file. I am using windows 10.
@talinon I did what you asked. It still did not work. Showing timeout error.
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process ""D:\xampp\php\php.exe" -d allow_url_fopen="1" -d disable_functions="" -d memory_limit="1536M" artisan package:discover" exceeded the timeout of 300 se
conds.
@nnnayeem . Any luck with this? I believe I'm having similar issues although I'm just starting out with Laravel. In my case, looks like php just doesn't know where to find the artisan command... I'm guessing I need to set a config value somewhere. Any suggestions?
@robertw my problem was in the service provider. As far as I could remember there was a script in the AppServiceProvider and it did not ran properly provided that the question was posted 10 months ago.
Check anything in the service provider. Any error in the service provider causees issues to artisan command. If you dump something in service provider you will see output in the artisan console. Just type php artisan and will show the dump data. You can try to find if the problem is in provider by dumping in the Provider(its my assumption though)
@robertw are you running php artisan in the same folder as the artisan file (the root of your project)
In my case there was an error in one of the Commands. Try to comment commands() function in Console/Kernel.php and see if artisan works.
This works, BUT WHY?
This worked for me as well, thanks so much! I had a db call in my construct of one of my commands (I was doing some testing) So, I got an error and none of my php artisan commands would work because the table wasn't migrated yet.
@nnnayeem This is because you have another command that has a construct function running infinitely, so artisan list is stuck and no error log
i had the same problem on windows in phpstorm 2019, for me it had something to do with xdebug , when its enabled in phpstorm (start listening debug connections) i was getting the exact behaviour, php artisan just hangs, just needed to disable listening and the problem disappeared
I had the same problem, I ran composer dump-autoload, this listed the problems I had in my code. problem was specifically was the auto-discover in composer.json
ran composer update and apparently composer v2 did not work with my package dependencies.
I down graded composer by rolling it back, and ran composer dump-autoload. made updates
and all worked just fine.
Had the same mistake because i put my handle code in my constructor
I solved it by deleting the vendor folder and the running composer install.
I don't know if this has been solved yet, but I found out that updating the composer version solved it for me: composer require laravel/passport --ignore-platform-req=ext-fileinfo This command will enable laravel to behave as it should regardless of the platform. I hope this helps.
this is because you wrote a wrong route or remember what you could do last time and comment on it and check your PHP artisan work In my case I wrote a wrong route that caused leakage of memory Check all commands and if you installed anything previously some third parties library that is the also reason of artisan command not work
I'm having the same problem. But, with me happens when I'm trying to update my project laravel 9 to laravel 10 and upgrade the spatie/laravel-ignition to ^2.0. I execute the composer update and my terminal show the error: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
My artisan stop to work after that, I tried to delete the vendor/ folder and didn't worked.
Please or to participate in this conversation.