Configure Redis to Use Unix Socket: Permission denied

Hello

I am trying to configure Redis to use Unix Socket to improve my WP speed. I followed this tutorial How to Configure Redis to Use Unix Socket Speed Boost •

Everything is ok except that in that tutorial all the WP files are owned by www-data user and group.

But in Hestia system, the website files are owned by an unique user instead of the default www-data:www-data

So. I always get the Permission denied error like in this screenshot Screenshot by Lightshot

How can I set the permission of user and group for /var/run/redis so all the users and websites can use it?

Thanks for your help
TOM

Probally due to open base dir restrictions. Check log files…

Can I pm to you the server login and could you please help me check this issues?

Thanks

If you are willing to pay 100 euro / hr for it offcourse I can help…

Sorry, I can’t

I am a student and trying to make some bucks online :slight_smile:

Your Error screenshot says PHPRedis Not Loaded, You are probably missing the PHP extension for Redis, so first install PHP libs that talk to Redis.

sudo apt install PHP<x.x>-redis

restart phpx.x-fpm

Then you need Redis plugin in your WP

Some old Vesta threads that might be helpful

https://forum.vestacp.com/viewtopic.php?t=14647

2 Likes

Thank you for your links
However, php-redis extension is not the reason, I guess

When I do chown user:user for /var/run/redis

So the plugin can connect to Redis socket. That’s the user/group permission problem.

Anyway, I will continue to use Redis as TCP connect instead of Unix socket at this time.

I think in that case the sock file needs to operate as the website user, that’s how php-fpm also run. So may be you will need a redis socket per user?

Or may be we can add redis user to some common group.
@falzo may have some ideas about this

I did research from your idea and create a common group and all all users into that by follow the commands on this link linux - Give write permissions to multiple users on a folder in Ubuntu - Super User

Now. All users can connect but the Redis Object cache plugin only show the TCP connection instead of Unix socket. I even changed the Redis port from 6379 to 0 and restart Redis but still same issues.

Here is the screenshot: Screenshot by Lightshot

Diagnostics from the plugin

Status: Connected
Client: Predis (v1.1.9)
Drop-in: Valid
Disabled: No
Ping: PONG
Errors: []
PhpRedis: Not loaded
Relay: Not loaded
Predis: 1.1.9
Credis: Not loaded
PHP Version: 8.0.17
Plugin Version: 2.0.23
Redis Version: 6.0.16
Multisite: No
Metrics: Enabled
Metrics recorded: 24
Filesystem: Working
Global Prefix: "wp_"
Blog Prefix: "wp_"
WP_REDIS_SCHEME: "unix"
WP_REDIS_PATH: "/var/run/redis/redis-server.sock"
WP_REDIS_PREFIX: "lowenddirectory.com"
WP_CACHE_KEY_SALT: "lowenddirectory.com"
Global Groups: [
    "blog-details",
    "blog-id-cache",
    "blog-lookup",
    "global-posts",
    "networks",
    "rss",
    "sites",
    "site-details",
    "site-lookup",
    "site-options",
    "site-transient",
    "users",
    "useremail",
    "userlogins",
    "usermeta",
    "user_meta",
    "userslugs",
    "redis-cache",
    "blog_meta"
]
Ignored Groups: [
    "counts",
    "plugins",
    "themes"
]
Unflushable Groups: []
Drop-ins: [
    "Redis Object Cache Drop-In v2.0.23 by Till Krüss"
]
root@scp:/var/run/redis# ls -lh /var/run/redis
total 4.0K
-rw-rw---- 1 redis redisuser 7 Mar 21 15:24 redis-server.pid
srwxrwxr-x 1 redis redisuser 0 Mar 21 15:24 redis-server.sock

I also posted a question on Redis Object Cache support forum here Redis did not switch from TCP to Socket | WordPress.org

Hope we can find the solution

Thanks all.

First of all check the error logs of PHP.

For 99,99% I am sure it gives a permission denied…

1 Like

I found the reason

sudo apt install php8.0-redis

Then

Amazing…

I posted all the details above so everyone can get it working like me.

Cheers,

1 Like

This is not a PHP logs…

This is some output of a plugin …

/var/log/apache/domains/domain.error.log or /var/log/nginx/domains/domain.error.log

Hestia is not a “Tool” for users without linux experience…

2 Likes

If you need help, you need to post information properly first. you never mentioned exactly what you put in your ‘config files’, nor what are the log files say. What ‘common group’ you made, and how? what is ls -lash output to show permission settings?
How is someone supposed to help you if we can’t even visualize what you are doing in the first place.

In my first post I told you phpx.x-redis extension needs to be installed, you ‘ignored’ that saying

php-redis extension is not the reason, I guess

while clearly thats the thing that worked.

Like @eris said, you need to learn basics first and you have to adopt a proper reporting attitude first. No help can be achieved if the issue is not reported in detail first.

I hope you learn and be better next time

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.