Magento 2 admin loading very slow after redis configuration - magento

I configured the redis on Magento 2.4.3. But after that my admin loading is very slow. When I debug then I found there in redis for session requests it is returning
"HINCRBY" "sess_llm5difqva5dpp955o4ansht8h" "lock" "1"
with multiple request that's why it is taking time to load in admin panel. Did anyone face this issue, if yes then can you please share the solution? On google I found one link https://github.com/colinmollenhour/Cm_RedisSession/issues/92 but there is no solution for it.

In your
app/etc/env.php
at array session[redis][disable_locking] is 0 ('disable_locking' => '0',)
it should be 'disable_locking' => '1'

Related

Session not persisting on shared hosting - Laravel 4.2.17

I have a problem with the sessions on the shared hosting.
I developed an app on a local server (XAMPP) and it works great (sessions, auth etc). The problems have appeared when I moved the app on a shared hosting.
I realized that the sessions are not persisting from a page to another or from AJAX files to another page and the Authentication does not work either .
The only session that persists is the _token which has a different value after every refresh of the page.
I have the following configuration in the session.php file:
'driver' => 'database',
'lifetime' => 120,
'expire_on_close' => false,
'lottery' => array(2, 100),
'path' => '/',
'domain' => null
First, I used file driver and I had the same problem, and now I used the database.
Both file and database work on the local server but on the shared hosting they do not.
I tried all the solutions found on the forum but still I have the same problem.
I think the problem is at the session domain setting because when I change the value from null to other string on my local server, I have the same problem that I have encountered online.
Can you help me, please!
Thanks, Mirel
I fixed the problem. In my case the error because I have added a php closed tag ?> in the end of the included files. So removing this tag will bring the application back to normal behavior.

cakephp session timeout not working

I have cakephp site, I was having problem that was after being idle for about >= 1 hour it gets log-out automatically
so I googled to extend timeout for that I wrote the following in core.php
Configure::write('Session', array(
'defaults' => 'php',
'timeout' => 28800, // 8 hours.
)
);
I want to keep a logged in user logged-in even after being idle for less than 8hours
but this is not working
how can I sort out this?
According to CakePHP manual, the unit of Session.timeout option is "minute", so 8 hours should be 60*8=480
Regarding the setting not work, I think maybe you could try to clean the cakePHP cache files / restart web server or change the debug level to 2 for troubleshooting?
CakePHP 2.0 manual sessions
May be you are using CakePHP 3, that is why you are facing this issue. Session timeout does not work in CakePHP 3, You might use cookie_lifetime, please check https://github.com/cakephp/cakephp/issues/5664
I had the same problem in CakePHP 1.3
The problem was that CakePHP was using the settings defined in php.ini instead of the one I was defining in core.php
So I had to change in core.php:
Configure::write('Session.save', 'php');
to
Configure::write('Session.save', 'cake');
And it worked like a charm!

Cakephp randomly drops session

Recently I moved my cakephp site from a hosting service to an other. The page was working like a charm, but now I'm having the issue, that my sessions randomly drop.
I'm on a shared hosting service, so I changed cake's session defaults from php to cake, now my sessions are saved to my tmp/sessions folder. (but it wasn't working with php either)
Followed my session's way with Firebug:
When i log into the page, i have a Sessionid, and in the tmp/sessions folder i have the corresponding sess_{sessionid} file too.
After a few clicks on some pages (totally random) my sessionid changes and i'm "logged out".
The session file with which i've logged in, remained in the directory.
My session settings in core.php right now:
Configure::write('Session', array(
'defaults' => 'cake'
));
I'm using the 2.3.8 version of Cake.
Update:
Finally i found the problem thanks to Nick. I checked the Cakephp error files, and found out that i only got logged out, when i visited a page containing an element, which was not on the server ( eg a picture was missing). So i went to Firebug, and check what the Net tab says. On the new Host service i got a 404 Not Found response AND a new session id set in the response, whilst on the other servers i tested the page, i simply got a 404 Not Found. If i randomly generate links to not existing files like (domain/test.jpg) i get the same results.
Try these settings, in Firefox you can install the web develop extension, then you can view your cookie to see if it is all set correct.
Configure::write('Session', array(
'defaults' => 'php',
'cookie' => 'yourdomain',
'timeout' => 44640,
));
Check any components that you are using for whitespace (usually at the end of the file).
I came across this recently whilst helping a client with their existing CakePHP site, when logged in one particular page that called a component was killing $this->Session->read(‘Auth’).
There is a CakePHP shell that you can use to find whitespace.

session timeout forever cakephp

i am working on a Cakephp 2.x ... i am using auth component ... the problem write now is that the session automatically expires after some minutes.. i mean if the user does nothing then CakePHP logs them out after some period...i want to make the session time forever unless he click the logout button ..i dont know how to to do this .. any help would be greatly appreciated
Here's my config code:
Configure::write('Session', array(
'defaults' => 'php'
));
I think the problem is that you're using the default php sessions and they are configured (in php.ini) to expire sooner than you want to. See.
If you want your logins to live forever it's probably better to use cookie based login. See this plugin for instance.

localhost to 127.0.0.1 as default

I am trying to use Magento on a localhost, but when I try and log in to the admin area the screen just refreshes.
In the address bar it was localhost/magento/.......(etc). When I changed it to 127.0.0.1/magento/.......(etc) it allowed me in. When I click on one of the buttons in the admin area it goes back to localhost/magento/......(etc) and I am once again faced with the login page.
How and where do I alter the setting the settings so the 127.0.0.1 is used as default rather than localhost.
Finally after seven hours of playing about with suggestions and re-installing I have fixed it, for those with the same problem i will share what I did.
I am using Magento 1.7.0.2. Apparently there is an issue regarding cookies when you install Magento on windows as it was designed for linux system. So you need to sort the cookie issue. To do this open your Magento folder and go to app>code>core>mage>core>model>session>abstract varien.php at lines 85-92:
// session cookie params
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()
);
change the code to this.
Apparently there are other issues such as php curl, I did not come across these but the following tut:
http://ecommercedeveloper.com/articles/1419-tutorial-avoid-two-problems-installing-magento-on-a-localhost/
covers it. Also that's where I got the information from, however the code in the version I'm using is slightly different from that version.
If you want to change loaclhost to 12.0.0.1 do following.
If you have database access go to "*core_config_data*" table and there change "web/unsecure/base_url" and "web/secure/base_url" to 127.0.0.1 instead of localhost.
Otherwise you can use the solution provided by tony09uk.
on OS X I found a simpler way - I am using MAMP running 127.0.0.1:8888, the default for MAMP installs.
Just set your /app/etc/config.xml line that says localhost to 127.0.0.1
delete var cache and session contents
clear cookies in browser
this now lets me login to the dashboard from the admin login screen.
If you have database acces open table: core_config_data
Do a search for: SELECT * FROM core_config_data WHERE path LIKE '%cookie%'
change: cookie_domain & cookie_path to = ""
(empty string).
Login once again to the admin panel. fixed!

Resources