Jump to content

Recommended Posts

Posted

Hi,

I am using following function to get online users count. But it appears that there is no permission for reading content of that dir. Can you help me please?

Server: tommy

function onlineUsers() {
        $i = 0;
        $path = session_save_path();
        if (trim($path)=="") {
            return FALSE;
        }
        $d = dir($path);
        while (false !== ($entry = $d->read())) {
            if ($entry!="." and $entry!="..") {
                if (time()- filemtime($path."/$entry") < 1 * 60) {
                    $i++;
                }
            }
        }
        $d->close();
        return $i;
}

Posted

Did you set read permissions for other on that file? You can right click on the file in cpanel file explorer or use ftp to change permissions. Filezilla calls other public permissions for instance.

Posted

Did you set read permissions for other on that file? You can right click on the file in cpanel file explorer or use ftp to change permissions. Filezilla calls other public permissions for instance.

Yes, I did. I set it to 777.

Posted

I read somewhere in the internet that shared hosting sessions are saved to the same path for everyone. Maybe is that why particular user can't read session dir? Just an Idea.

Posted

666 is better unless you need to execute the file for some reason. 6 = read/write, 7 = read/write/execute. Directories generally need execute permissions, but unless the file is cgi or a command line script it doesn't need execute. Try changing the directory that the files are in to 777 though.

Posted

666 is better unless you need to execute the file for some reason. 6 = read/write, 7 = read/write/execute. Directories generally need execute permissions, but unless the file is cgi or a command line script it doesn't need execute. Try changing the directory that the files are in to 777 though.

Still not working

Posted

Well, you can set the session path to whatever you want with

ini_set('session.save_path', $path);

tried, but still shows the session path asĀ /var/cpanel/php/sessions/ea-php73

Posted

here is my output

/var/cpanel/php/sessions/ea-php73
/var/cpanel/php/sessions/ea-php73
Posted (edited)

Okay I figured out the problem. ini_set function need to be called at the top of php file. inside a function doesn't work.

Edited by mrj

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...