SOLVED accessing root directory in php

oah

Well-Known Member
Jan 23, 2018
51
9
8
Iraq
cPanel Access Level
Website Owner
Hi
I am trying to access the unix socket file located at '/tmp;/redis.sock', however the path of the current site is being added and I am getting something totally different as a result. I attached the error code below:


[18-Apr-2020 21:36:11 UTC] PHP Fatal error: Uncaught RedisException: No such file or directory in /home/dtcaswaq/public_html/test123.php:11
Stack trace:
#0 /home/dtcaswaq/public_html/test123.php(11): Redis->connect('/tmp/redis.sock')
#1 {main}
thrown in /home/dtcaswaq/public_html/test123.php on line 11


the php code snipped that I am using is like this:

Redis->connect('/tmp/redis.sock');

So how to fix that?
 

oah

Well-Known Member
Jan 23, 2018
51
9
8
Iraq
cPanel Access Level
Website Owner
Are you using CloudLinux and CageFS?
I am using Centos-7. I was about to post the solution it turned out to be a permission issue for the temp folder. So what I did was to change the config file for redis (change the socket location) to something like this /redis_sock and gave full permission on that file to redis and php users. Also modified my php connection to be:

Redis->connect('/redis_sock/redis.sock');

Now it is working just fine.