I've uploaded an entire Laravel site. The first time everything was working fine.
Now I had an update and did the same thing all over again. Now the URLs are wrong. Whatever route I choose I get an
InvalidArgumentException in FileViewFinder.php line 137:
View [errors.404] not found.
I also see the following:
at FileViewFinder->findInPaths('errors.404', array('C:\xampp\htdocs\myApp\app\resources\views')) in FileViewFinder.php line 79
Which is really incorrect.
If I echo something in routes.php I can see the echo.
Update
The OP has website in shared hosting with-out SSH access to run artisan commands.
php artisan cache:clear
php artisan route:cache
Problem
Route cached: The OP uploaded local project into shared hosting with cached routes. Which caused routes conflict.
Laravel assumes c:\xampp\{project_name} to be local directory while it was different path.
Solution
The solution was to remove bootstrap\cache\ content (Cached routes)
Related
My code in on production and I ran
php artisan config:clear
After that, my code was not running. The index pages and all other pages went white screen and gave 500 internal server error in firebug. When I tried to run
php artisan
it gave me error as
PHP Fatal error: Call to undefined method Closure::__set_state() in /var/www/live/vendor/config.php on line 56
My code is in production!! /vendor/config.php file was not present before, what happened with that code??
Have you faced any such error?
I had given all permissions to storage/ folder and vendor/.
Any help/guide would be much appreciated.
I had similar issues when I ran php artisan config:cache. Apparently, it is an issue when the application is trying to load cached configuration files that have closures in it. It won't be fixed in Laravel since it is a bad practice to have closures in config files. Refer this Github issue
The way I solved this is by undo-ing this.
Delete the cache for config.
It is located in here
bootstrap/cache/config.php
OR
vendor/config.php
I had faced the similar issue in past don't know what caused it but as of now you can delete the config.php from /vendor it won't break your code.
And your code will be start working..
Among other root-causes, this error results from calling php artisan config:cache when a closure is defined inside any configuration file that Laravel attempts to load. Laravel does not allow for closures in configuration files; see:
https://github.com/laravel/framework/issues/9625
Deleting the resultant cache file, usually located at bootstrap/cache/config.php, "fixes" the error.
The long-term solution is to eliminate closures from all configuration files. The problematic config file can be determined by inspecting the offending line, as mentioned in the error message.
If the offending file is third-party, it is best to open an issue with the library, so that the issue is fixed upstream.
Here is what I did to solve it:
Go to /vendor/tymon/jwt-auth/src/config/config.php and replace the lines for storage and auth with:
'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter'
Go to /bootstrap/cache/config.php and delete it
Run the following commands in order:
A) php artisan config/cache
B) php artisan jwt:generate
C) php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
and that should do it!
Try to remove the config.php from bootstrap/cache folder. It worked for me.
Edit vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:108
and delete required.
Changing the config.php file inside the vendor/tymon/jwt-auth/src/config to this
'auth' => Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter::class`
and this
'storage' => Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter::class`
before runnning php artisan config:cache worked for me.
solved using
composer update
composer install
I installed Laravel (in W10/Wamp3.3/PHP5.6) using Composer and created a new project with the following command:
laravel new my_project
Project doesn't have a welcome page, opens file-list directly. So I decided to try my chance on creating a new controller and create a route.
php artisan make:controller Hello
And my route in routes/web
Route::get('/hello', 'HelloController#index');
I also cleared the route cache:
php artisan route:clear
Created the controller with no methods. myproject/hello shows nothing.
What am I missing? File permissions or wamp based problem?
There's a question related with this but it's more like a server problem.
Few causes for this that I've run into. Most likely one is going to be the server pointing to the incorrect directory. What I would do to test is run php artisan serve from the root of the project. This will open up a server pointing to public directory. If this functions correctly then you have confirmation.
Using Laravel 5.4. it's giving me an error of
NotFoundHttpException in RouteCollection.php line 161:
I'm uploading files under storage directory. I can see files in project-root/storage/app/files
Also I have created symlink using php artisan storage:link. When I visit the generated link (http://example.com/storage/files/RcDPA5N6FpTWCnnh2w8bQO85id53oAiCeZgITpwB.png)
though, it gives me not found exception.
Also I'm wondering if I'm referring resource then why route is being called.
That command will generate a symlink to app/storage/public so the files would need to go in app/storage/public/files and then they should be accessible via http://example.com/storage/files/RcDPA5N6FpTWCnnh2w8bQO85id53oAiCeZgITpwB.png.
I know there is bunch of answer out there and none of them solved my problem. I am giving a try again in 2016 may be some one can help.
php artisan make:migration createxxxtable
don't show any error and it don't create the file
neither of these function output anything too.
php artisan list
php artisan help migrate
Its not new project. I had been working on this project earlier and it was working fine. Created bunch of migration.
I tried deleting everying inside vendor and do composer install and composer update still no luck.
I did tried command like dump-autoload , optimize , clear-compiled etc. too
Thanks
Ok found the solution. I don't know whats the reason. But it was because I was using url() helper in a custom config file i created in config folder. The config file and value of url and others works fine all across the website but it just break artisan command. I don't know why.
Removing that url() helper from my custom config file solved the problem.
Normally when this issue arises it's due to an error in your code. Check for these coporates
Could be a typo in your .env file
Could be a syntax error in your .env
Entering in wrong configuration(syntax error) in your config folder
can you please try php artisan does that open up the artisan commands?
If these doesn't show anything then check your path to project in console.
I have this issue with homestead where it can't access any of my views instead it tells me NotFoundHttpException in RouteCollection.php line 145: (this is a new project) . When I try accessing an old laravel project which I made it works perfectly fine but when I create a new project it throws me this error. Now I have also tested it with php artisan serve and try accessing this on localhost:8000 and this works without problems. so why does homestead have problems?
NotFoundHttpException is actually thrown when there was no matching route found.
Seeing how it's working fine using artisan serve I think you should have a look wether the 'app' is setup properly in the Homestead configuration.
You can find more info on that here: https://laravel.com/docs/5.2/homestead#adding-additional-sites
In blade use url() funtion to route
for example
<a href='login'>test</a>
to
<a href='{{url("login")}}'>test</a>
And make sure that mod_rewrite in enable