NotFoundHttpException in RouteCollection.php line 161 laravel 5.2 - php

I'm new on laravel , I didn't write any code yet but when I open my project it gives me this error , anyone can help me to solve it ?
[

Just try http://localhost:8000 since it seems like you already started development server in your local machine using php artisan serve while you were on your project root via terminal.
Or you can try from begining:
Go to your project root from terminal / cmd
Run php artisan serve
Now try http://localhost:8000 which is equivalent to http://localhost/laravel/public , considering laravel is your project folder name.

Related

php artisan serve not working giving error In ProviderRepository.php line 208:Class 'Laravelium\Sitemap\SitemapServiceProvider' not found

I'm working for the first time in laravel while setting up the already developed project in my local computer and running php artisan serve i'm getting this error
In ProviderRepository.php line 208:
Class 'Laravelium\Sitemap\SitemapServiceProvider' not found
Issue is resolved by just follow these step. Go to your project > bootstrap->cache->config.php remove the provider and aliases from the cached array manually.

Php Artisan serve command not serving Laravel 5.8

I installed a new Laravel instance, using version 5.8. Along the way, I found out that I can't serve the project using the normal Laravel php artisan serve command.
After some research with lots of trial and error, I came across this answer on StackOverflow that helped me with this method php -S localhost:8000 -t public/ with which I followed to change the port to port 9000, and it served the project perfectly.
Now my question is how can I go about getting the artisan command to be the default command to serve and rum my Laravel 5.8 on Windows just like before? I don't know anything about configuring Laravel core commands.
I tried this command.
php -S 127.0.0.1:9000 -t public/
after running this its works fine.
and also php artisan serve command works fine.
hope it will help.
You should open ServeCommand.php file (Illuminate\Console) and then change getOptions method
protected function getOptions()
{
$host = env('SERVE_HOST', '127.0.0.1');
$port = env('SERVE_PORT', 8080);
return [
['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', $host],
['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', $port],
];
}
when create a SERVE_HOST and SERVE_PORT in your .env file
SERVE_HOST=localhost
SERVE_PORT=9000
source
You can run the project on port 80. If you are using Linux simply run the command from the embedded server with root user permission.
Example: sudo php -S localhost: 80 -t public /

Cakephp 3.4.14 Exception: Shell class for "Serve" could not be found

here is my shell snip
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/app
$ bin/cake serve
Exception: Shell class for "Serve" could not be found. in [D:\xampp1\htdocs\app\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php, line 327]
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/app
$ cd ../pocketpa-git-clone000000/
Maan#DESKTOP-TNA7PJU MINGW64 /d/xampp1/htdocs/pocketpa-git-clone000000 (master)
$ bin/cake serve
Exception: Shell class for "Serve" could not be found. in [D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php, line 327]
Warning Error: file_put_contents(D:\xampp1\htdocs\pocketpa-git-clone000000\logs\cli-error.log): failed to open stream: No such file or directory in [D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Log\Engine\FileLog.php, line 133]
PHP Warning: file_put_contents(D:\xampp1\htdocs\pocketpa-git-clone000000\logs\cli-error.log): failed to open stream: No such file or directory in D:\xampp1\htdocs\pocketpa-git-clone000000\vendor\cakephp\cakephp\src\Log\Engine\FileLog.php on line 133
last night i shut down my pc and in morning when i restart i am facing this issue
cakephp version 3.4.14
php 5.6.36
and having this problem when wants to start project
Sorry my bad i was messed up with diffferent projects i was working on Laravel Projects and using frequently
php artisan serve
This command will start a development server at http://localhost:8000:
when i come back to CakePhp Project i was messed up and trying
bin\cake serve
command to start local server for cakephp environment http://localhost:8765/
thats make me so much trouble
But the orignal command to run CakePhp Sever on LocalHost is
bin\cake server
here you can get more details https://book.cakephp.org/3.0/en/installation.html#development-server

Laravel looking for path on my localhost instead of deployed server

I have Laravel installed on my localhost. And when I try to deploy it to the server, it throws an error: View [frontend.layouts.login] not found.
And I can see that it is looking at my local file path when on my machine aka:
/Applications/MAMP/htdocs/personal/project_name/resources/views
Instead of the server's file path.
If I try and copy the project outside of the personal folder (on my local machine), so make the file path:
/Applications/MAMP/htdocs/project_name/resources/views
It gives the same issue?
Is it something with caching the views?
The other error on the same page is:
file_put_contents(/Applications/MAMP/htdocs/personal/project_name/storage/framework/sessions/7a0aaa6c977031111312b785c7b7e22a659b6a36): failed to open stream: No such file or directory
And again, the server has nothing to do with my local machine.
What could be going on?
This issue is due to the Laravel Configuration Caching.I suggest you
Remove the configuration cache file
Flush the application cache
Create a cache file for faster configuration loading
To do this, run the following Artisan commands on your command line
php artisan config:clear
php artisan cache:clear
php artisan config:cache
Where you don't have access to the command line on your server, you can programmatically execute commands like this:
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('config:clear');
$exitCode = Artisan::call('cache:clear');
$exitCode = Artisan::call('config:cache');
return 'DONE'; //Return anything
});
I hope this is helpful.
I think this might fix it
Go to config/app.php
and change the url to your production url
'url' => 'http://localhost',
I had the same issue so i tried many things including all the solutions in this question, but it didn't work.
What worked for me is that i just deleted this file bootstrap/cache/config.php and it worked.

Laravel: Error InvalidArgumentException

I' upload the project from localhost to my dedicated server and after so many problems, finally some pages works domain.com | domain.com/home | domain.com/allsites etc..
But now, the routes "domain.com/site/create"
"domain.com/site/ID/manage", "domain.com/site/ID/edit" not found, i get this error, why?
InvalidArgumentException in FileViewFinder.php line 137: View [Site.create] not found.
in FileViewFinder.php line 137 at
FileViewFinder->findInPaths('Site.create',
array('/....../resources/views')) in FileViewFinder.php line 79 at
FileViewFinder->find('Site.create') in Factory.php line 151
I try artisan comands: cache:clear, route:clear, config:clear, config:cache and nothings works, i don't know where is the problem!
On localhost it works perfectly
also multiple times its found that config cache being problem. Use following commands to finetune them.
php artisan config:cache
php artisan config:clear
If your local OS is different from your production server OS you might be running into a case-sensitive issue and the file is not being found. make sure your files names are EXACTLY the same, case and all. This can happen especially if one environment is Mac and the other is Linux.
If the issue is not fixed, please go through the following link. It may help you
Laravel 5 - View [home] not found
Laravel 5.1 View not found
Laravel 5 InvalidArgumentException in FileViewFinder.php line 137: View [.admin] not found
I had same issue but cause was different. For me the problem was permissions on errors folder. In particular the folder was not executable.
To resolve on linux:
$ chmod +x ../views/errors
Try one of these commands:
php artisan dump-autoload or composer dump-autoload
check you passed argument are in database fields or not!
$mailData = array(
'type' => 'email_subscription',
'user_mail' => $obj->email_id
);
Mail::to($request->input('email'))->send(new SendMail($mailData));

Categories