Go Back   The macosxhints Forums > Working with OS X > OS X Developer



Reply
 
Thread Tools Rate Thread Display Modes
Old 12-20-2002, 08:46 PM   #1
der
Prospect
 
Join Date: Jan 2002
Location: Hong Kong
Posts: 24
PHP permission problems

I'm new to PHP but I've been trying to set up page to display the currently playing track in QT Streaming Server.
I've got everything working nicely except that the PHP gives me permission errors when it tries to access the file in the quicktime streaming directory.
If I copy the playlist.current file to the webserver/documents/ folder where the php file is located it works fine.

The code and errors are below - I think it might be to do with PHP permissions to access folders but I'm not sure - can anyone help?

<?php

// Define path to playlist.current
$path = "/library/quicktimestreaming/playlists/eclectasy/eclectasy.current";

// Read playlist.current into $file
$file = fopen($path, "r");

// Read the contents of $file into $content
$content = fread ($file, filesize($path));

// Separate into parts and put in $info array
$info = explode("/",$content);

// Delete .mp3
$song = substr($info[5], 0, -4);

// Make sure to close after you open
fclose($file);

// Print the information
echo "<br> Track: $song <br>";
echo "<br> Album: $info[4] <br>";
echo "<br> Artist: $info[3] <br>";

?>

And the output I get:



Warning: fopen("/library/quicktimestreaming/playlists/eclectasy/eclectasy.current", "r") - Permission denied in /Library/WebServer/Documents/trackinfo.php on line 7

Warning: stat failed for /library/quicktimestreaming/playlists/eclectasy/eclectasy.current (errno=13 - Permission denied) in /Library/WebServer/Documents/trackinfo.php on line 10

Warning: Supplied argument is not a valid File-Handle resource in /Library/WebServer/Documents/trackinfo.php on line 10

Warning: Supplied argument is not a valid File-Handle resource in /Library/WebServer/Documents/trackinfo.php on line 19

Track:
Album:
Artist:
der is offline   Reply With Quote
Old 12-20-2002, 08:50 PM   #2
nosaj56
Triple-A Player
 
Join Date: Jul 2002
Location: Louisiana
Posts: 208
What are the permissions on the folder your "eclectasy.current" is in? (and the folders up from that.)
nosaj56 is offline   Reply With Quote
Old 12-20-2002, 09:03 PM   #3
der
Prospect
 
Join Date: Jan 2002
Location: Hong Kong
Posts: 24
nosaj - you are the man!!!

I did chmod 777 on the directory, not just the file and it worked!!!

Probably a simple error but I'm a newbie to all this!

Cheers

Der
der is offline   Reply With Quote
Old 12-20-2002, 09:04 PM   #4
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
we need to see owner/group and permissions of the directories in the path to the
playlist

show us the appropriate output, like so...
Code:
$ find /Library/QuickTime -type d -print0 | xargs -0 ls -ld

drwxrwxr-x  10 root  admin  340 Nov  5 05:50 /Library/QuickTime
drwxrwxr-x   4 merv  admin  136 Oct  2 11:13 /Library/QuickTime/Toast Video CD Support.qtx.diasbled
drwxrwxr-x   4 merv  admin  136 Oct  2 11:13 /Library/QuickTime/Toast Video CD Support.qtx.diasbled/Contents
drwxrwxr-x   4 merv  admin  136 Oct  2 11:13 /Library/QuickTime/Toast Video CD Support.qtx.diasbled/Contents/MacOSClassic
but, put quicktimestreaming in place of QuickTime above (i don't have
quicktimestreaming installed)
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 12-20-2002, 09:05 PM   #5
nosaj56
Triple-A Player
 
Join Date: Jul 2002
Location: Louisiana
Posts: 208
Dern permissions...
nosaj56 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.