Snow Leopard mounted directory changes permissions sporadically

Posted by Galen on Stack Overflow See other posts from Stack Overflow or by Galen
Published on 2010-06-14T19:59:21Z Indexed on 2010/06/14 20:02 UTC
Read the original article Hit count: 253

Filed under:
|
|

I have a smb mounted directory: /Volumes/myshare

This was mounted via Finder "Connect to Server..." with smb://myservername/myshare

Everything good so far.

However, when I try to access the directory via PHP (running under Apache), it fails with permission denied about 10% of the time. By this I mean that repeated accesses to my page sometimes result in a failure. My PHP page looks like:


<?php
  $cmd = "ls -la /Volumes/ 2>&1";
  exec($cmd, $execOut, $exitCode);
  echo "<PRE>EXIT CODE = $exitCode<BR/>";
  foreach($execOut as $line) {
    echo "$line <BR/>";
  }
  echo "</PRE>";
?>

When it succeeds it looks like:


EXIT CODE = 0
total 40 
drwxrwxrwt@  4 root   admin    136 Jun 14 12:34 . 
drwxrwxr-t  30 root   admin   1088 Jun  4 13:09 .. 
drwx------   1 galen  staff  16384 Jun 14 09:28 myshare 
lrwxr-xr-x   1 root   admin      1 Jun 11 16:05 galenhd -> / 

When it fails it looks like:


EXIT CODE = 1
ls: myshare: Permission denied 
total 8 
drwxrwxrwt@  4 root  admin   136 Jun 14 12:34 . 
drwxrwxr-t  30 root  admin  1088 Jun  4 13:09 .. 
lrwxr-xr-x   1 root  admin     1 Jun 11 16:05 galenhd -> / 

OTHER INFO:

I'm working with the PHP (5.3.1), and Apache server that comes out of the box with Snow Leopard.

Also, if I write a PHP script that loops and retries the "ls -la.." from the command-line, it doesn't seem to fail.

Nothing is changing about the code and/or filesystem between succeeds and fails, so this appears to be a truly intermittent failure.

This is driving me crazy. Anyone have any idea what might be going on?

Thanks, Galen

© Stack Overflow or respective owner

Related posts about php

Related posts about apache