View [admin.sellers.show] not foun | Illuminate/View/FileViewFinder.php | line 137 - php

I deploy laravel 5.8 project on server, then when I was tryng to make delete request got this error
the project work fine on the local
this error show on another pages when it tring to make request delete request ,
View [admin.contacts.show] not found.
View [admin.brands.show] not found
php version : v7.4.33
I run this commands in server terminal
php artisan cache:clear
php artisan view:clear
php artisan config:cache
it still show the same error
note : I tried to deploy the same project on another server , I got the same error but it fixed with the previes command.
so did I miss something in the first server ?

here is my answer for my question , It's not one issue but 2 issues
first one is caching views , routes , and config
make sure to run this commands after each edit on the server.
php artisan view:cache
php artisan route:cache
php artisan config:cache
then for some reason my server delete request was not working
why I don't know, because of that the project was working fine locally and fine on another server .. after tens times of edits and tests with no real results because of app caching I didn't not that after a long time of trying and testing, and debugging.
I realized that in my server delete request is called the show method which is like destroy method URL https://url/sellers/{id} but with the get method, so, and show method has this unknown view.
in the end, I used the cache command after each time I made an edit on the server and changed the delete request to post request with pass _method: 'delete' as body request and it's fixed.
note: delete request may work on another server because it's works on my second server
my test :
delete request only
response
delete request with _method:'delete'
request body
response
finaly with post request and _method: 'delete'
request body
response
done

Related

Very slow response if there is an error in laravel view or component

I'm new to laravel and I'm building a pure laravel 9 app(no vue, nodejs or other frameworks just laravel + vanilla js). If I have any kind of error in any laravel view/component/partials the error page response tooks more then 20seconds to appears. If I have an error in any controller/model/config or other laravel's environment files, the same error is superfast. In example if I have a typo in my view layout.blade.php
PHP
#php
ech 'missing a letter';
#endphp
this will throw the error in 20 seconds
if I place a typo in a controller like this
PHP
public function index() {
retur 'missing a letter';
}
this will throw the error instantly.
if this can helps, checking in my console the laravel log file like this
DEBIAN BASH
tail -f /var/www/mylaravelapp/storage/logs/laravel.log
will throw the error in the same time that appears in the laravel error page.
Obviuously is not a big deal, but since I'm working on the appareance of the UI, this will slow down my work so much.
UPDATE
I'm adding a screen of my devtools opened, it simply waits for server response 23 seconds
UPDATE
Some new details, really strange for me, what happens is that in my component I have some pure javascript script in the bottom of the page(around 500 rows). If I delete the scripts the error page will run superfast. I tried to place the scripts directly behind the scripts tags and I tried using the #pushOnce directive with same results. I tried to reduce the amount of code, and the more I reduce the code the more will run faster. I tried to put the script directly in my layout.blade.php that calls the component and it runs superfast, I tried to put the js code like an external script and it runs superfat, so problem happens only with inline JS probably I'm placing the scripts in a wrong way
UPDATE
OK I think this update is important, if I run my laravel app through my apache web server(so not using php artisan) the error page will load superfast, so this cannot be related to some code error. Usually I run my laravel app in this way
php artisan serve --host 192.168.25.209
where 192.168.25.209 is a server in my network that is hosting my laravel app. As #Don't Panic pointed in the comments
"The web server runs only one single-threaded process, so PHP applications will stall if a request is blocked"
So I checked for permissions on cache storage folders, but everything looks good, cache files and logs are correctly written

How to clear cache automatically on symfony?

I'm trying to create a new route like this:
#Route("/restaurant/", name="restaurant")
#Route("/work/", name="work")
#return Response
But when I visit /work/symfony in my browser, it returns this message:
Unable to parse file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml": The XML file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml" is not valid.
When I clear the cache with the following command, it works:
php bin/console cache:clear -v
How can I fix this, without need to clear my cache all the time?
I found the solution by starting a symfony server instead of using XAMPP by running : symfony server:start as simple as that ...

Why does the payload invalid error appears?

enter image description hereenter image description hereI'm getting a payload invalid error for every artisan command:
![][2]
My application was working fine previously without any error, until I ran the app a few days ago on localhost and this error is shown.
You seem to have an old version of the views. Please, run the following commands and try again:
php artisan cache:clear
php artisan view:clear
The payload invalid issue arises when the blades are of different version and the vendor files are of different version.A simple solution is to copy all the content in your current page and then copy it inside a newly created blade with the same version as of the vendor files.

laravel - Move app to another server, blank page and artisan error

I need to move app in laravel from web server to local sever (I trying on XAMPP). I moved all files, database and in files I changed URI in:
/index.php
<? header("Location: http://localhost/public"); ?>
but I get errors in:
On http://localhost/ I have blank page
On http://localhost/public and every another route I getting error: http://pastebin.com/zUFqS8ET
When I use php artisan or another commands I getting error:
[ErrorException]
Undefined index: HTTP_USER_AGENT
I forgot about somethink?
EDIT:
Ok, I downgrade my PHP to 5.6.* but artisan still not working - same error, what's the problem?
EDIT 2:
Here is logs - problem is in SMF but I don't know why ...
http://pastebin.com/HZQ7CZeg
Sorry, I know this is obvious. But, have you run PHP composer install? And as a basic test you can create an empty laravel project to test your computer's configuration. If it works then you know its something in your project you need to update.
Laravel installation

Laravel 4 Commands stopped working suddenly

Back from vacation, and when I'm trying to run one of my previously working command:
php artisan list
Throws me:
[root#api2]# php artisan list
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function getArgument() on a non-object","file":"\/var\/www\/html\/api2.alariscms.com\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":153}}
And I seriously cannot understand why this happens. I tried debugging the file that throws an error. It awaits argument:
InputInterface $input but it gets NULL
I don't know what can go wrong on a framework level to stop receiving the required object.
Any ideas where to start debugging from? Or I can reload configurations / update laravel via cmd?
Thanks
This is what I would do:
php artisan dump
composer dump-autoload
check for current Laravel version
and then go to that specific command and check for bug there.
Also, what kind of argument are you trying to pass to command ? Is that object - if so check where is implementation of that class ?

Categories