Have you just got the Laravel error could not open input file artisan?
Usually, the error shows up when a user tries to open the Laravel project outside the project folder.
At Bobcares, customers often approach us to fix Laravel errors, as a part of our Server Management Services.
Today, let’s see how our Support Engineers fix this Laravel error.
Laravel application structure
Laravel is a PHP framework for web application development. A composer is a tool that integrates the dependencies and libraries.
It includes the dependencies in the composer.json file. This file is usually placed in the source folder.
Laravel has a command-line interface. This is known as Artisan. It has a set of commands to assist web application development. To start the Laravel service, we use the command,
php artisan
But in some cases, this ends up in errors. Our customers often approach us to fix errors while accessing the artisan console. Today, let’s discuss one such error.
Laravel error could not open input file artisan
Could not open input file: artisan
This is a very common error message that a Laravel user gets.
Usually, users get this error while trying to access a project using the command, php artisan
. In the command-line, the error appears as,
Now let’s see why does this error appears.
1. Wrong console location
This error mainly occurs when a user tries to open a Laravel project outside the project folder. Laravel can only execute the project if we open it inside the project folder.
That is what the error says ‘could not open input file‘. So whenever customers approach us with this error, we ask the customer to re-check the location where they execute the command.
2. Improper permissions of artisan
Sometimes the artisan may not be executable. If the user tries to execute the command, it cannot access it. And the user receives this error.
So to make artisan executable, we use the command
chmod +x artisan
Later try to use the command, and it will work.
[Still, having trouble in loading your Laravel project? – We can help you.]
Conclusion
So far we saw the reasons for the Laravel error could not open input file artisan. Incorrect console location and improper permissions trigger the error. We also saw how our Support Engineers fix it.
Actually for me I don’t have the Author folder in my controllers folder. So I decided to use the php artisan:auth to create that inside my folder and the command was showing me “can not open input file”
Hello Kuol,
The Auth folder will be located at App\Http\Controllers\Auth. Looks like there is something wrong in the command that you used to create auth file. This depends on the Laravel version that you are using. If you need further assistance, we’ll be happy to talk to you on chat (click on the icon at right-bottom).
Thanks!
Indeed terminal was set to htdocs instead of actual laravel project div.
Worked, Thanks.
Please mak esure everybody to get to the exact project directory where all the files exist and project created.
Hi Fahad,
Thanks for the feedback.We are glad to know that our article helps you solves the issue ?