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

SS54's avatar
Level 1

I was learing forms and validation and Laravel stopped

While I was learning about Forms and everything was working normally, all of a sudden I started to get the Error (Object not found ) (Error 404). I get this even if I execute

Route::get('/', function () { return view('welcome'); });

0 likes
40 replies
Snapey's avatar

and that error message contains lots of useful information.... why not post it here?

1 like
SS54's avatar
Level 1

@Snapey No, when open the browser and write http://localhost:3000/cms.test, I get simply get (Object not found) in addition to (The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404 localhost Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.4.6 )

That is all I get on the browser page.

Snapey's avatar

So its a problem with your local web server not laravel code

SS54's avatar
Level 1

@Snapey The local server seems to have been working perfectly. when I write http://localhost/phpmyadmin, it works. Even Laravel worked fine a few days ago. What could be a possible reason behind this, please.

jlrdw's avatar

@SS54 did you recently change the web server configuration. Try restarting server, and logging out of OS and logging back in. I have had to do this with Nginx on Windows.

But apache just needs a server restart.

But just suggestions only.

1 like
SS54's avatar
Level 1

@jlrdw I have not made any change on my XAMPP server nor changed anything else. I made a restart of all things and the same thing persists.

jlrdw's avatar

@SS54 make a route like:

Route::get('hello', function () { echo "Hello"; });

Do you see hello in server? Note you may need a leading slash in front of hello.

Also clear all cache including config.

1 like
SS54's avatar
Level 1

@jlrdw I tried this to no avai; please have a look at my route

Route::get('/', function () { echo view('welcome'); });

Route::get('/hello', function () { echo "Hello"; });

Route::resource('/posts', 'PostsController'); Route::group(['middleware' => ['web']], function () {

});

jlrdw's avatar

You aren't caching routes in development? Try to run php artisan route:clear.

But if things were working and suddenly you have this problem there must be some kind of config error somewhere.

Back track your steps when all worked. Are you using git versioning.

1 like
SS54's avatar
Level 1

@jlrdw The clearing did not work. No I am not using versioning, as I am only doing first steps learning

Sinnbeck's avatar

Make sure php works first. Make a test.php file in the public folder and call it in the browser.

Put this in the file

<?php
echo 'works';
SS54's avatar
Level 1

@Sinnbeck The file I created in the Public folder did not work, as opposed to the one I created in the htdocs which worked.

SS54's avatar
Level 1

Also just now I noticed something strange. When create a migration and then migrate it the table get created. but after going further the table disappear and only the migration remain there

jlrdw's avatar

@SS54 have you recently setup a virtual host to use apache? If so make sure you add it in the host file, and then do like I said above, restart apache, logout and log back in.

What is that localhost:3000? Is that the build in php server? You need to make the VH, and point to public as document root in order to use apache.

1 like
SS54's avatar
Level 1

@jlrdw Yes all these things were already done. and the local domain points to the public folder. I cannot figure out what suddenly happened. I used to install Laravel dozens of time but this time I dont understand

jlrdw's avatar

@SS54 if you are already familiar with laravel you could try this:

  • delete the vendor folder
  • delete composer.lock
  • run php artisan clearcache
  • run composer install

Sometimes re-installing the framework fixes things. But it is hard trying to figure out why things aren't working all of a sudden.

Another thing you could try is: deleting packages.php and services.php from bootstrap cache folder.

You may want to backup project prior.

1 like
SS54's avatar
Level 1

@jlrdw Thank you for your time trying to help with this

In order to install Composer, should I first uninstall the existing composer from the control panel ? Should I use the command composer install to install composer ?

jlrdw's avatar

@SS54 just type composer then hit enter, it gives a list of commands.

But why do you need to delete composer?

1 like
SS54's avatar
Level 1

@jlrdw I tried all your suggested points and I began to have more serious errors for example when I write php artisan and hit enter I get PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in C:\xampp\htdocs\cms\bootstrap\app.php:14 Stack trace: #0 C:\xampp\htdocs\cms\artisan(18): require_once() #1 {main} thrown in C:\xampp\htdocs\cms\bootstrap\app.php on line 14

Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in C:\xampp\htdocs\cms\bootstrap\app.php:14 Stack trace: #0 C:\xampp\htdocs\cms\artisan(18): require_once() #1 {main} thrown in C:\xampp\htdocs\cms\bootstrap\app.php on line 14

I do not think I am gonna go out of it without having to run a new install and this time I think it should be Laravel 8 not 5.2 .45 >>>> what do you think

automica's avatar

@SS54 considering Laravel 5.2.45 is over 5 years old, I would definitely not use that for a new project.

1 like
SS54's avatar
Level 1

@automica What is the latest recommended and stable version for 8.x

SS54's avatar
Level 1

@jlrdw I have installed a fresh Laravel 8.70 in the same directory /htdocs/cms. The problem still the same. I kept the same vhost because I am using the same domain (cms.test). I have a feeling that the problem is very trivial and I am not able to figure it out.

The vhost poits to <VirtualHost *:3000> DocumentRoot "C:/xampp/htdocs/cms/public" ServerName cms.test

Does the documentroot remain correct as above

automica's avatar

@SS54 have you ran composer install in your htdocs/cms directory?

1 like
SS54's avatar
Level 1

@automica yes I just did and it installed in the said directory I am still getting (Object not found)

jlrdw's avatar

@SS54 you probably also had an old xampp, have you considered a newer xampp.

Also show your virtual host setup. I also use xampp, but have never got an Object not found error.

1 like
SS54's avatar
Level 1

@jlrdw Yes I am still having the older XAMPP. If I reinstall it I must also change the ports and the vhost as well. After all if I remain desprate I may reinstall the XAMPP. If I do, will I have to reinstall the Laravel?

(virtual host) Screenshot

SS54's avatar
Level 1

@jlrdw I re checked the host and the link you sent but still getting

Object not found

SS54's avatar
Level 1

@jlrdw I do not think there is a stacktrace. Probably I am going to reinstall the xampp

jlrdw's avatar

@SS54 If you get all working again, backup often and possibly use version control. I have a script that backs up my laravel projects to a zip file and puts them on Onedrive just in case.

2 likes
jlrdw's avatar

@Snapey yes I use Git also, but still like making a zip of project.

1 like
SS54's avatar
Level 1

@jlrdw Thanks for your good advices. You are probably supposing that the source of the problem is coming from my Laravel. Now I am rather convinced it is coming from my XAMPP which is also confusing me because it is working perfectly with a WooCommerce website. Unfortenately I am not versed with versioning. Do you know an easy tutorial for versioning

SS54's avatar
Level 1

@jlrdw

I reinstalled the xampp, reinstalled the Laravel 8.70.x, changed port numbers of the Apache, and everything is back to normal now. i will only make a backup of the xampp and the Laravel project. Thanks for every attempt you made to help me resolve the unexplained issue.

1 like

Please or to participate in this conversation.