Jump to content

[Solved] can not read session save path in php


mrj

Recommended Posts

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;
}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...