Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot access file from browser

Status
Not open for further replies.

phillip2005

Technical User
Oct 19, 2006
4
GB
I can usually fix computer problems myself using manuals, Google or searching forums. But for this problem I'm not sure where to look, or of the terminology to even phrase the question to get a sensible number of search results.

I've been doing an exercise in PHP that generates a web page from a script ( a table filled with links to playlists of my music ) but when I click the links the music player opens (with the relevant playlist) but the songs just cycle through the player without playing - this is what the player does if it cannot find the music files.

The songs in the playlist are listed;
#EXTINF:-1,etc,
Now I'm sure this is a security related question of some type in that Apache is stopping the delivery of the song and there's some way to authorize it. But I've looked through the list of directives and can't see anything that applies. Any ideas please.
Relevant(?) section of my httpd file is below...

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
#<Directory "F:/My Documents/My Web Sites/Apache2.2/htdocs">
<Directory "D:/WebDev/Apache/htdocs">
#<Directory "D:/WebDev/localhost/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# # for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>
 
Hi

I would say the audio file is probably delivered without problem, but by default Apache has not MIME type configured for .flac files. So probably just the player is confused by the irrelevant [tt]Content-type[/tt] header.

Add this line
Code:
AddType application/flac	.flac
or this
Code:
application/flac	flac

Feherke.
 
I put the addtype line into my httpd file and restarted Apache but it didn't work. But it did give me an idea so I saved some songs as WAVs, created a playlist and those worked OK from the browser. (So proving it is a file 'type' problem not a Apache wont access the files 'security' type problem)

Interestingly the FLAC files are displayed in the WinAmp playlist as ' (the files being in local) which is how they are listed in the playlist. But the WAV playlist is displayed as '01.wav' when their playlist entry is ' (they are in the AllSaints directory). I mention that as any odd snippet can give a clue.

After Googling I did find a reference to "application/x-flac flac" at so I tried that but no joy.

I also tried adding flac in the mime.types file thus "audio/x-wav wav flac" and "audio/x-flac flac"

Do I also need an AddEncoding? or some of the other directives at ' ?
I'm starting to get the feeling after a few hours of Googling now that Apache doesn't suppor FLAC files at the moment.
 
Hi


phillip2005 said:
Do I also need an AddEncoding?
No. That is other thing. The Content encoding topic on the same page explains it.
phillip2005 said:
Apache doesn't suppor FLAC files at the moment.
A web server does not has to support any static file it serves. It is just matter of sending it, has nothing to know about the file, only its MIME type. Which I would still say, you need to set it. No idea to what.

Feherke.
 
Dumb question but does your browser know how to handle this type of file? To test, just use windows explorer to access the file then open it using internet explorer. As feherke said, apache doesn't know or doesn't care anything about the file. It just needs to know what type it is so it can serve it properly. This test takes apache out of the loop so you can test the browser.

 
Arrrgggghhh!!!
This is really annoying. This problem arose out of an exercise I set myself to learn php. As I said earlier the script generates a web page filled with links to playlists. These links are in the form of
<a href="file:///F:\My%20Documents\My%20Music\Playlists/Pink%20-%20I'm%20Not%20Dead.m3u"><font color="yellow"> I'm Not Dead</a>
When I click on them (here comes the annoying part) in Firefox nothing happens. I've just found out that if I use the evil empires' IE they work!
Now I have assumed for some time the problem lay with Apache, either with security, not allowing access to random areas of my file system, or not liking flac files.
Here's a summary of testing so far, I hope I explain it clearly as it's doing my head in.
As I say using "file:///F:\My%20Documents\My..." works OK in IE. Nothing happens in Firefox.
<a href="Pink.m3u"> is a link to a playlist I created in the same directory as the php page. It just cycles through the songs without playing in both IE and Firefox. But at least being in the same directory seems to cause it to get as far as opening WinAmp with Firefox. (The playlist does work fine when run from Explorer)
<a href="PinkHTTP.m3u"> is a link I created that has the playlist edited as URL's, as in Again this cycles through the songs without playing in IE and Firefox.
<a href="AllSaintsWAV.m3u"> is a link created that does the same as the one above but plays WAV files in place of FLAC's listed in the playlist as This works fine.

I'm not making this up! As I say this is only an exercise in php so isn't important in any way. I could acheive a similar result after all by just putting my playlists folder on my browsers links bar. It's megga strange though. If anyone has a ureka moment then let me know, but it's not worth researching into for me. Thank you for all the suggestions so far though.

p.s. my Firefox Tools/Options/Manage (file types) section is currently set to;
m3u winamp playlist file Open with winamp
flac winamp medai file Open with winamp
 
I'm fairly sure that an appropriate test of browser vs. apache would be to store the .htm files on your local drive and open them directly wtih the browser's file|open command.

I don't see anything here that represents a (mis-)configuration problem with apache. What I do see are a lot of variables between browsers/players/settings that are probably not appropriate for the apache forum, IMHO.

D.E.R. Management - IT Project Management Consulting
 
:) I said at the top I was having difficulty phrasing the question. I originally started a topic in a php forum.
I think there may be more than one problem I'm looking at, as I cannot imagine a fix that would explain everything.
As for storing the htm that was one of the very first things I did. I did a Firefox View/Page Source and copied the text into a htm document. If I access it by
file:///D:/WebDev/Apache/htdocs/local/test.htm the main body of links (not my test links) work OK, if I access it by
it doesn't.
Also, while I'm sure there is a browser setup aspect here, that doesn't explain why neither browser will play a flac playlist defined as but will work with WAV's listed as Still not to worry, I'm sure people have more important things to worry about :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top