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

martianmaikel's avatar

php artisan serve doesn't load assets anymore

Hey, I have an inexplicable problem with Laravel (10) for which I haven't been able to find a solution on google or here in the forum.

I have already implemented 3 projects with Laravel and everything has worked flawlessly so far. A few days ago I wanted to create a new Laravel project with Livewire - everything set up, styling included, php artisan serve, let's go. Unfortunately, the styling and Js were not applied. Instead I get ERR_INVALID_HTTP_RESPONSE on all assets. For the sake of transparency, I also loaded this template http s:// github.com/themesberg /volt-laravel-dashboard - which, however, raises the same problem. Even older projects no longer load any assets, although I haven't changed anything on them. So in summary: my php artisan serve command doesn't seem to load any assets on my local machine (Win11) for any Laravel project. It only works with php -S localhost:8000 -t public .

I checked config, cache, .env etc. I don't think that this is the problem (also because no project works anymore)

I also use XAMPP on my machine. But I made no changes to php version oder apache config whatsoever in last months.

I would still like to continue using php artisan serve and find out why the named problem can suddenly exist across all projects. I have all my projects under C:\Dev\Projects and I made no major changes the last days. The problem wasn't there on one day and on the next day no project was working properly with php artisan serve anymore.

I would be very grateful for tips or solution ideas. Take the htt ps:// github.com/themesberg /volt-laravel-dashboard as example codebase.

0 likes
8 replies
nexxai's avatar

When you attempt to browse to the page, what shows up in DevTools -> Network? Is it trying to fetch the assets and it's throwing an error? If so, which HTTP status code? Is the fetch just not happening at all? We'll need more data than just "it's not working" to help you out here.

martianmaikel's avatar

@nexxai Hey. Unfortunately I don't get a http status code. In DevTools Console there I can see, that it tries to fetch all my js and css resources (and pictures) but result for each is ERR_INVALID_HTTP_RESPONSE. In DevTools -> Network there appears only one css resource without a status code but it failed. (no more information). Resources from cdn loading perfectly fine but anything from local "/v endor/fontawesome-free/ css/all.min.css" or "http: //127 .0 .0.1:8000/vendor/fontawesome-free/css/all.min.css" fails. If I try to enter the URL manually like "http://127.0.0.1:8000/vendor/fontawesome-free/css/all.min.css" its again ERR_INVALID_HTTP_RESPONSE and with "http://127.0.0.1:8000/public/vendor/fontawesome-free/css/all.min.css" it's a 404 - if I use "php artisan serve". Also changing the port of localhost doesn't fix the problem. I think the problem must come from my machine (win11) or some other configurations, but I don't have any idea what could cause this problem - also because it seems to be exclusive to the artisan serve command. laravel.log also dont list any errors.

nexxai's avatar

I don't know if it's the OS - although if a firewall got enabled without an exception for inbound traffic on port 8000, it's possible - because it sounds like a configuration problem with XAMPP.

  1. Nothing in the /vendor folder should ever be accessible, so that tracks
  2. The only folder that should be configured to be served from any webserver (in your case: Apache) is the /public folder, and that should be the root folder; specifically, you should never have to visit https://server.tld/public, you should only ever have to visit https://server.tld. Serving anything more than that can cause massive security issues as things like your .env file and its contents (like API keys, etc.) will be publicly accessible
  3. My suggestion would be to dig into the XAMPP config and find out if anything changed unintentionally? Maybe try removing the current configuration and creating a new one from scratch?
martianmaikel's avatar

@nexxai

  1. I know, was just for testing and the template I shared here via github https://github.com/themesberg/volt-laravel-dashboard links libs in the vendor dir. I made no changes to the repo to make sure that I'm not doing something terrible wrong. Same result by using localhost/css/app.css.
  2. Yes, I tried this. Normally php artisan serve points to the public dir. I'm also running the app like this php -S localhost:8000 -t public. So the problem isn't that the artisan serve command not pointing to public dir. (check)
  3. I also thought about this and checked the files but I made no changes in the last couple of months. And I also thought that php artisan serve doesn't use my XAMPP apache (instead it uses own server configuration and the inbuilt php dev server).

Thank you for your replies so far and for trying to help me. I'll be on vacation starting tomorrow, I'll google something and try it out and I'll get back to you when I've found a solution.

dennistian's avatar

I got the same issue here. Does anyone have a solution?

martianmaikel's avatar

@dennistian Unfortunately no. I now develop my new project by using vite for the css and js and including it in the views via @vite(...) - this works perfectly fine. But buildung the css and js and including this (it is in public/assets) still doesn't work on my local machine by using php artisan serve

anchan42's avatar

Try php -S localhost:8000 -t public instead of artisan serve.

Please or to participate in this conversation.