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.

asked Sep 8, 2013 at 17:40
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. Commented 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. Commented Sep 8, 2013 at 20:42
  • What's the output of mount ? Commented Sep 9, 2013 at 3:48
  • Output from ls /mnt is BUDrive Commented Sep 9, 2013 at 6:37
  • what's the output of the mount command ? Commented 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.

answered Oct 13, 2013 at 4:59
1
  • 1
    thumbdrive or hard drive* Commented Oct 13, 2013 at 5:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.