session.save_path incorrect in magento + memcache for session - magento

I am trying to configure Magento to use memcache for session. I have installed memcached and also php5-memcache. I have also added "extension=memcache.so" in memcache.ini.
I have made sure the memcached instance is also running in the localhost port number 11213. However, when I try to login to Magento admin I get an error -
Warning: Unknown: Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct (tcp://127.0.0.1:11213?persistent=0&weight=2&timeout=10&retry_interval=10) in Unknown on line 0
The following is the memcache configuration in local.xml -
<session_save><![CDATA[memcache]]></session_save>
<session_save_path><![CDATA[tcp://127.0.0.1:11213?persistent=0&weight=2&timeout=10&retry_interval=10]]></session_save_path>
The following are the grep for memcached,
www-data 1329 1 0 08:13 ? 00:00:00 /usr/bin/memcached -d -m 64 -p 11213 -u www-data -l 127.0.0.1
www-data 1511 1 0 08:18 ? 00:00:00 /usr/bin/memcached -d -m 64 -p 11211 -u www-data -l 127.0.0.1
www-data 1518 1 0 08:18 ? 00:00:00 /usr/bin/memcached -d -m 64 -p 11212 -u www-data -l 127.0.0.1
I have been meddling up with this for a couple of days now and I am not sure what the issue. Any help is appreciated.
Thanks,
G

Please note there is a difference between memcache and memcached. I’ve found that the Magento sessions integration expects you to use this:
<session_save><![CDATA[memcached]]></session_save>
You should install the PHP memcached libraries, as well.

Related

Unable to connect to local redis docker although up and running

Using the following redis.conf
▶ cat redis.conf
bind 0.0.0.0
spinning up a redis container
▶ docker run -d --name redis-test -p 11111:6379 -v /Users/redis.conf:/redis.conf redis redis-server /redis.conf
59eb1612e8c3e2403e18ce889ce1438f6c6a23a7c70bed30b46ff765b7fe7038
logs seem healthy
▶ docker logs -f 59eb1612e8c3e2403e18ce889ce1438f6c6a23a7c70bed30b46ff765b7fe7038
1:C 18 Mar 2021 17:57:13.954 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 18 Mar 2021 17:57:13.954 # Redis version=6.2.1, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 18 Mar 2021 17:57:13.954 # Configuration loaded
1:M 18 Mar 2021 17:57:13.955 * monotonic clock: POSIX clock_gettime
1:M 18 Mar 2021 17:57:13.955 * Running mode=standalone, port=6379.
1:M 18 Mar 2021 17:57:13.955 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 18 Mar 2021 17:57:13.956 # Server initialized
1:M 18 Mar 2021 17:57:13.956 * Ready to accept connections
container seems up
▶ docker ps | grep -i redis
59eb1612e8c3 redis "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:11111->6379/tcp redis-test
If all the above are more or less good indications, why am I unable to connect to the container
▶ redis-cli -h localhost -p 11111
Could not connect to Redis at localhost:11111: Connection refused
not connected>
▶ redis-cli -h 127.0.0.1 -p 11111
Could not connect to Redis at 127.0.0.1:11111: Connection refused
not connected>
Working on MacOS Catalina
Find the IP Address of container called redis-test by running this command (I'm in Linux, but I think that should be the same on MacOS, sorry if that's not the same):
docker inspect redis-test | grep -i ipaddress
The result should be something like this:
"IPAddress": "172.21.0.2"
Now try:
redis-cli -h 172.21.0.2 -p 11111

Connecting to ProxySQL via socket - "No such file or directory"

I am trying to connect to ProxySQL from PHP with mysqlnd using the local socket, but I get
"No such file or directory"
, as the socket would not exist. The same code can connect to the mysql socket with no problem.
Basically I am reproducing what was described at:
https://www.percona.com/blog/2017/09/19/proxysql-improves-mysql-ssl-connections/
<?php
$i = 10000;
$user = 'percona';
$pass = 'percona';
while($i>=0) {
$mysqli = mysqli_init();
// ProxySQL
$link = mysqli_real_connect($mysqli, "localhost", $user, $pass, "", 6033, "/tmp/proxysql.sock")
or die(mysqli_connect_error());
$info = mysqli_get_host_info($mysqli);
$i--;
mysqli_close($mysqli);
unset($mysqli);
}
?>
This throws:
mysqli_real_connect(): (HY000/2002): No such file or directory
The socket file (/tmp/proxysql.sock) is in fact there:
$ ls -all /tmp
total 12
drwxrwxrwt. 11 root root 4096 Oct 7 17:33 .
dr-xr-xr-x. 28 root root 4096 Sep 20 17:42 ..
drwxrwxrwt. 2 root root 6 Aug 8 02:40 .font-unix
drwxrwxrwt. 2 root root 6 Aug 8 02:40 .ICE-unix
srwxrwxrwx 1 proxysql proxysql 0 Oct 7 17:11 proxysql.sock
I can use the mysql client to connect through it:
$ mysql -u myuser -p --socket /tmp/proxysql.sock --prompt='ProxySQLClient> '
If in the above PHP code I replace the socket file with the MySQL socket, then that works. It is only the proxysql.sock which doesn't work with mysqlnd.
I am using:
mysqlnd version mysqlnd 5.0.12-dev - 20150407
ProxySQL version 2.0.6
Any idea why the proxysql.sock is not accepted by mysqlnd?
UPDATE: Following #EternalHour's suggestion below, I have also tried moving the proxysql.sock file out of /tmp, but unfortunately that didn't make a difference. I am still receiving the same error.
EDIT (2019-10-08): It turns out this issue has nothing to do with PHP, as netcat throws the same problem too, whether the socket files in in /tmp or in /var/sockets/:
$ nc -U /tmp/proxysql.sock
Ncat: No such file or directory.
Out of the 3 nodes of the ProxySQL cluster running on the same OS, same kernel version, 1 has this issue, the other 2 allows connection to the socket file in /tmp/proxsql.sock, although over there too, sometimes restarting ProxySQL results in the socket file being created as private (eg not available to other applications)
Many MySQL Clients have a special handling of the wordlocalhost. localhost doesn't mean "use the resolver to resolve localhost and connect via TCP" but "use unix domain socket on the default path" to use TCP use 127.0.0.1 instead. If proxySQL also provides a unix domain socket provide that path.
I am sorry everyone, the issue was embarrassingly simple - it was simply my fault.
When I was changing the socket file's location in ProxySQL Admin I was using the following
update global_variables set variable_value='0.0.0.0:6033;/tmp/proxysql.sock ' where variable_name='mysql-interfaces';
SAVE MYSQL VARIABLES TO DISK;
Yes, that is a space at the end of "/tmp/proxysql.sock ".
When I was changing it to different locations, I only rewrote the first half of that (the folder), never the filename, so I just keep copying the space and hence always got file or directory not found...
Problem solved!
Sorry about it

apache chown on its files not working

My apache user generate one file :
# ls -lsa /tmp/reference_file.csv
76 -rwxrwxrwx 1 apache apache 69921 Aug 16 14:14 /tmp/reference_file.csv
the user and the group belong to apache, but when i am trying to change it :
su -l apache -s /bin/bash
-bash-3.00$ whoami
apache
-bash-3.00$ chown explorer:btunix /tmp/reference_file.csv
chown: changing ownership of `/tmp/reference_file.csv': Operation not permitted
I tried to another folder, but the result was the same, I ve also checked attribut :
# lsattr /tmp/reference_file.csv
------------- /tmp/reference_file.csv
there is no immutable attribut
How can I do ?
Thanks
There are criteria associated with chown. Only super-user can chown files willy-nilly. Whether you can give away a file that you own depends on your UNIX flavor and how associated kernel configuration parameters (like K_CHOWN_MAY_GIVE_AWAY, for argument's sake) may have been, well, configured. This is the most GENERALLY correct answer.

Redmine files upload error

I have a problem with files upload in Redmine. Error is: 500 internal server error.
In logs I have no information ( apache log & production.log ).
What I have tried:
Change rights on /usr/share/redmine/files to 777 ( no result )
Change rights on /usr/share/redmine to 777 ( no result )
Checked owner for /usr/share/redmine ( it is admin )
Checked PassengerDefaultUser ( it is admin )
Result of "ps -ef | grep Passenger | grep -v grep" command:
root 27534 26624 0 17:23 ? 00:00:00 PassengerWatchdog
admin 27537 27534 0 17:23 ? 00:00:01 PassengerHelperAgent
nobody 27543 27534 0 17:23 ? 00:00:00 PassengerLoggingAgent
admin 27588 1 0 17:23 ? 00:00:04 Passenger RackApp: /usr/share/redmine
System: Apache 2.4, Passenger Apache/2.4.10 (Debian) mod_fcgid/2.3.9 Phusion_Passenger/4.0.53, Redmine 2.5.2.stable
I tried all that I can, but have no result. :-(

OSX Server: apache2 running but “Problem loading page”

I have setup OSX Server 10.6, all updates installed, started apache2, which is running:
sudo apachectl graceful
I see in /var/log/apache2/errorlog
[Fri Dec 17 10:11:49 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations
Also
ps -ef | grep httpd
shows several processes:
0 49388 1 0 0:00.05 ?? 0:00.07 /usr/sbin/httpd -D FOREGROUND
70 49389 49388 0 0:00.00 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
70 49390 49388 0 0:00.00 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
70 49391 49388 0 0:00.00 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
70 49392 49388 0 0:00.00 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
...
In httpd.conf I edited DocumentRoot:
ServerName bioinfo.mni.fh-giessen.de:80
DocumentRoot "/Volumes/ServerHD2/Web_Documents"
ErrorLog "/var/log/apache2/error_log"
<Directory "/Volumes/ServerHD2/Web_Documents">
Order Allow,Deny
Allow from All
</Directory>
Syntax is OK:
apachectl configtest
Syntax OK
Yet, I get timeouts at http://bioinfo.mni.fh-giessen.de :
Problem loading page
Any clue ?
Are you sure you edited the right file? OS X Server has a way of not keeping to standards. The actual configuration entries are not in /etc/httpd/httpd.conf, but in subdirectories of /etc/apache2/sites. Check out this FAQ.
I would recommend using the Server Admin utility to set up the server. It will be a lot easier and quicker than trying to get the configuration right manually. You can always add or change rules later, once the site is up and running.
No direct local GUI access possible for a few days, no access via Remote Desktop either. My only way is ssh right now, but I will be happy to try Server Admin utility in a few days. For now I am restricted to the command line. Yes, I edited both /etc/apache2/httpd.conf and /etc/apache2/sites/0000_any_80_.conf, without avail. Is
sudo serveradmin fullstatus web
anyhow instructive :
web:readWriteSettingsVersion = 1
web:totalKBytes = 0
web:emailRulesRunning = no
web:boundToKerberos = yes
web:teamsRunning = yes
web:postfixRunning = no
web:servicePortsRestrictionInfo = _empty_array
web:health = _empty_dictionary
web:currentThroughput = 0
web:passwordResetRunning = no
web:ApacheMode = 2
web:statusMessage = ""
web:apacheVersion = "Unknown"
web:state = "RUNNING"
web:setStateVersion = 1
web:apacheState = "RUNNING"
web:proxyState = "STOPPED"
web:htCacheCleanRunning = no
web:calendarRunning = yes
web:servicePortsAreRestricted = "YES"
web:currentRequestsBy10 = 0
web:logPaths:logPathsArray = _empty_array
web:totalRequests = 0
web:startedTime = ""
?

Resources