Mena
Mena

Reputation: 2029

Laravel development server closing

I am working on a laravel 6 api only application so I am testing the endpoints using postman. I am getting this error when I make request to any of the endpoints

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:\Elo\apiProject\server.php' (include_path='.;C:\php\pear') in Unknown on line 0

From vscode terminal I can see that the development server starts, accepts then closes as seen below

$ php artisan serve
Laravel development server started: http://127.0.0.1:8000
[Thu Apr  2 21:05:53 2020] PHP 7.4.0 Development Server (http://127.0.0.1:8000) started
[Thu Apr  2 21:05:59 2020] 127.0.0.1:53500 Accepted
[Thu Apr  2 21:05:59 2020] 127.0.0.1:53500 Closing
[Thu Apr  2 21:27:23 2020] 127.0.0.1:53668 Accepted
[Thu Apr  2 21:27:23 2020] 127.0.0.1:53668 Closing

I have no idea why it is closing and no information inside the log file. What could be responsible for throwing such error?

Upvotes: 2

Views: 5636

Answers (2)

I had the same issue.In my case it was when I started to work in the project from another computer and so, I did "git clone".

I solved the problem by creating a ".env" copying the .env.example and then, I executed the command "php artisan key:generate" to generate the new API_KEY, which is mandatory for the start of the server.

Hope it helped you !

Upvotes: 0

Romain Karmann
Romain Karmann

Reputation: 11

I had the same issue and I think it's related to the port 8000. Maybe it's already in use or something like this because when I changed the port to 9000 (ie: php artisan server --port=9000) it solved the issue and works just fine now.

Upvotes: 1

Related Questions