and that error message contains lots of useful information.... why not post it here?
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'); });
@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.
So its a problem with your local web server not laravel code
@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.
@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.
@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.
@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.
@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 () {
});
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.
@jlrdw The clearing did not work. No I am not using versioning, as I am only doing first steps learning
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';
@Sinnbeck I have created the file in two places. First I created in the Public folder and I called through http://localhost:3000/xampp/htdocs/cms/public/test.php
Second I cretaed the file in the htdocs folder and it worked I called through http://localhost:3000/test.php
@Sinnbeck The file I created in the Public folder did not work, as opposed to the one I created in the htdocs which worked.
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
@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.
@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
@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.
@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 ?
@SS54 just type composer then hit enter, it gives a list of commands.
But why do you need to delete composer?
@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
@SS54 considering Laravel 5.2.45 is over 5 years old, I would definitely not use that for a new project.
@automica What is the latest recommended and stable version for 8.x
@SS54 follow installation guide https://laravel.com/docs/8.x/installation
@SS54 the installer will take care of the version. But the latest is shown here:
https://github.com/laravel/framework/tags
and
https://github.com/laravel/laravel/tags
Note there is one repo for laravel another for framework.
Edit:
Also with all those errors, something wasn't setup correctly, make sure you point to public as your document root.
@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
@SS54 have you ran composer install in your htdocs/cms directory?
@automica yes I just did and it installed in the said directory I am still getting (Object not found)
@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.
@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)

@SS54 Since laravel has a nginx example but not apache, the example I adapt to laravel is:
https://github.com/nova-framework/docs/blob/4.2/getting-started/install.md#xampp
Just adjust for laravel. Remember to sign out and back in and restart apache. Note that the example is webroot, remember, laravel uses public (not webroot).
@jlrdw I re checked the host and the link you sent but still getting
Object not found
Give the stacktrace.
@jlrdw I do not think there is a stacktrace. Probably I am going to reinstall the xampp
@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.
@jlrdw what, no source control :-)
@Snapey yes I use Git also, but still like making a zip of project.
@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
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.
Please or to participate in this conversation.