0

I'm attempting to automate a home music system, I've got most of it working. All is working brilliantly thus far, however...

I've started seeing this:

[Sun Sep 08 17:19:54 2013] [error] [client 192.168.1.15] PHP Warning: dir(/media/BUDrive/Document_Backups/Mp3s/faith no more): failed to open dir: Permission denied in /var/www/detect.php on line 124

This is part of the webservice I've got running. I've given apache full root access (as it's hosted on a local lan, not available to the outside world). I've also added www-data to the pi group. Yet, this still happens.

The /media/BUDrive/ is a mounted external hdd. All running lovely with samba and accessible via DLNA also.

What am I missing? How can I let this php script to access the external file system?

Edit (More info):

Excert from ls from command line of the mounted drive:

pi@rpi ~ $ ls /media/BUDrive/Document_Backups/Mp3s/ Alice Cooper Alice In Chains Alien Ant Farm Alkaline Trio All That Remains Andy McKee A Perfect Circle August Burns Red Avenged Sevenfold balkan beat box Bare Naked Ladies Biffy Clyro Blind Melon Bloodhound Gang Bullet For My Valentine Clawfinger Clutch

The function that attempts to find the directory:

function processMusicAgain($s)
{

    $parentdir = "/media/BUDrive/Document_Backups/Mp3s";
    $d = dir($parentdir."/".$s);
    if(!$d)
    {
            echo "I'm sorry, I can't find anything by ".$s;
    }
    else
    {
            $d->close();
    }
}

All I get is the "I'm sorry, I can't find anything by ...".

This is regardless of spaces in folder names or not. I've tried all of them and it never finds anything, only writes the above error to apache error_log.

7
  • show your code. does it only happen on directories with spaces in them? also, show that you can access with "ls" on the commandline of your pi.
    – tedder42
    Sep 8, 2013 at 19:49
  • @tedder42 - Have edited my post with the details you requested. No, it doesn't matter if I ask for "All that Remains" or "Clutch". Google's api, knows what I'm saying each time, as I've checked the returned array, many times. Sep 8, 2013 at 20:42
  • What's the output of mount ?
    – Lawrence
    Sep 9, 2013 at 3:48
  • Output from ls /mnt is BUDrive Sep 9, 2013 at 6:37
  • what's the output of the mount command ?
    – Lawrence
    Sep 9, 2013 at 8:44

1 Answer 1

1

You need to format your thumbdrive to ext4 without journaling

mkfs.ext4 -O ^has_journal /dev/sda1

Then you can change the permissions so that www-data user can access it... if its fat32 or exFat then you can't give www-data permissions to access the folder.

1
  • 1
    thumbdrive or hard drive*
    – jason
    Oct 13, 2013 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.