The project is Prestashop in PHP server. I have accidently change the controllers/front/ProductController.php's name into ProductController.phps. I immediately change it back to ProductController.php. But the system return response code 500 with error after I reload the page:
ClassNotFoundException
Attempted to load class "Product" from the global namespace.
Did you forget a "use" statement for "PrestaShop\Module\FacetedSearch\Hook\Product"?
How can I fix this?
(update)
Before I accidently done the wrong change, I remember I also remove the classes/Product.php. When I reload the page and found it does not change anything (not even error 500), I add it back to the system. I guess that could be restore the system automatically.
You can try to delete the cache files manually from:
var/cache/prod
var/cache/dev
Or, at least class_index.php, which is available there.
I want to create a template for page not found. whenever 404 no route found exception is throwing need to redirect to page. As that is not in proper UI way. I tried steps from this URL
https://symfony.com/doc/current/controller/error_pages.html
I am new to symfony . followed steps until service.yml and created customExceptionController.php and I dont know what to do next step and I am getting error like
How to fix this issue.Please anyone help me to get out of this issue. Thanks in advance
In the dev environment, you will always see the default exception page which is meant to ease debugging issues. If you want to see how a certain error page looks like in the prod environment (because you maybe created a custom template for it), you need to access a special URL that is only available for this purpose in the dev enviromnent (see https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development). In your case, this URL is http://127.0.0.1:8000/_error/404
In Laravel 5.5, When you are using CSRF protection (by default) and you send a post request after long inactivity you'll get this error page (Screenshot).
I'm ok with this error however, I need to change the view/text of this error to match my application style and my language for sure.
Any Ideas in how to edit this view?
You can override the default view by placing a 419.blade.php file in the resources/views/errors folder.
If you're using an editor with global search capabilities, you can search for the error message inside your project. For example, in Visual Studio Code you can press Ctrl + Shift + F to search inside the project.
I use it all the time to find the files which are part of the framework that I need to customize.
More on overriding the error views in this section of the official docs.
You can override the default view by placing a 419.blade.php file in the resources/views/errors folder.
I'm doing a laravel app but when I try to create an account it gives a csrf error..
When I check what cookies the website have, I find that I have no cookies, there should be a XSFR-TOKEN and a laravel_session cookies, but laravel is not generating any of those cookies, so it gives me a token not found when i try to create an account.. anyone know why it does that? any idea how to fix that?
Also just installed a new clean laravel and find out if I put the "app" view inside of a folder it also happends and doesnt generate the cookies, I have tried to change the folder permissions but the problem persists.
Open your http app/Http/Kernel.php file and check if your Kernel::$middleware array contains:
Illuminate\Cookie\Middleware\EncryptCookies
Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
Illuminate\Session\Middleware\StartSession (this is middleware which is responsible for passing data to session driver in Laravel 5)
Illuminate\View\Middleware\ShareErrorsFromSession
App\Http\Middleware\VerifyCsrfToken
To clarify - Kernel::$middleware array contains middleware which is executed on every HTTP request. By default it contains middleware that is essential for session support in Laravel. Perhaphs you accidentaly deleted them.
Here is original file: https://github.com/laravel/laravel/blob/v5.0.22/app/Http/Kernel.php
I'm hosting my PHP Yii application on AWS Elastic Beanstalk and hence using the database to store sessions. I've successfully implemented facebook login using Hybridauth on a shared hosting environment. When I host on Elastic Beanstalk facebook login gives the error:
"You cannot access this page directly"
The URL ends up as:
http://mydomain.com/hybridauth/default/callback?hauth.start=Facebook&hauth.time=1393106016
I've learnt from here that this is related to facebook calling back to the application but finding a different session. Endpoint.php then throws the error:
# Init Hybrid_Auth
try {
// Check if Hybrid_Auth session already exist
if ( ! isset( $_SESSION["HA::CONFIG"] ) ) {
header( "HTTP/1.0 404 Not Found" );
die( "You cannot access this page directly." );
}
How can I ensure facebook calls back to the same session and successfully signs in with hybridauth?
Its due to PHP SESSION name
If you have change session name in confing file of Yii. Then you have to use add this session_name('samar_v4'); in file protected/modules/user/vendors/hybridauth/Hybrid/Endpoint.php in starting of functoin authInit
Check your Facebook application's redirect URL. Facebook doesn't allow multiple redirect URLs. So each time you change your hosting/domain/address, you'll have to reconfigure the Facebook application's redirect URL or use a different set of credential.
Also your redirect URL should be something like this: http://mydomain.com/hybridauth/?hauth.done=Facebook
This worked for me as well:
"base_url" => "https://example.com/inc/hybridauth/",
I changed it to
"base_url" => "https://".$_SERVER['HTTP_HOST']."/inc/hybridauth/",
For me it worked on the main domain but not on a subdomain. I worked out it was the base_url in config.php that caused the error.
Instead of
"base_url" => "https://mydomain.com/inc/hybridauth/",
I changed it to
"base_url" => "https://".$_SERVER['HTTP_HOST']."/inc/hybridauth/",
Now it works anywhere I put it.
For anyone else struggling with this issue, and its not related to the www-domain registration issue, my problem had to do with not being able to write to the php session directory. Not sure how or when it was altered, but if you cannot write to /var/lib/php/5.5/session, hybridauth will not work.
As per the other answers, I believe this is a session problem, perhaps the session is started under the wrong domain and then cannot be re-fetched under the other domain.
I solved this by removing various ServerAlias settings from my development Apache config.
this 'caused' the error:
ServerName mydomain.com.au.localhost
ServerAlias www.mydomain.com.au.localhost
ServerAlias localhost.mydomain.com.au # << using this one
this fixed the error:
#ServerName mydomain.com.au.localhost
#ServerAlias www.mydomain.com.au.localhost
ServerName localhost.mydomain.com.au # << using this one
apachectl restart
(I normally use mydomain.com.au.localhost so I'm leaving them in for later use.)
I had the same issue using Hybrid Auth 2.8. It relates to our custom session handler which is set by session_set_save_handler().
Hybrid Auth uses standard PHP sessions, so after redirecting and opening a new session, Hybrid Auth starts using standard PHP file sessions instead of your custom session handler. This result in the loss of config data from our session and getting this error message.
I resolved this issue by adding our own custom session handler at the top of hybridauth/index.php (located in the same dir as config.php and live.php).
This forces Hybrid Auth to use your custom session handler.
I found this problem that seems unsolvable. I was giving up, that's when my instinct led me to do a test and voila everything working.
For anyone with the same problem have a question: The file that calls the API is in the same directory it?
Me only worked when I put my file in the same folder as the config.php file. Try it there and tell me if it works!
A hug
and Greetings to all!
I solved my particular HybridAuth "You cannot access this page directly" error with the domain name on the session cookie. My app exists on a subdomain and I'd designed the redirect to point to socialize.sub.domain.tld, and the cookie wasn't reaching the _Endpoint.
Changing the session domain to .domain.tld solved it. - Hope this helps :)