Problem with slash vs. backslash

General discussion about netjukebox
Post Reply
BigBossMan
User
Posts: 33
Joined: Wed Mar 30, 2005 9:27 am
Location: SLC, Utah, USA

Problem with slash vs. backslash

Post by BigBossMan »

OS: RH Fedora 3
Apache 2.0
mysql 3.23.58
php 4.3.11

I have tried to edit the config.inc.php to reflect the proper directory

using: /home/media & \home\media

both give me the NJ error Directory not found, change media_dir value in:
/var/www/html/netjukebox/include/config.php.ini

I thought I read in another post that changes had been made to correct this. Have I done something wrong or is this a code issue?

BBM
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

> I thought I read in another post that changes had been made to correct this. Have I done something wrong or is this a code issue?
Yes, that is right some scripts have been changed for that.
For the update.php script there where no changes needed.
(Windows, Linux and OSX can use the / to read a directory)

With a friend of my we have extensively tested netjukebox on OSX.
Everything works even streaming with a OSX compile of lame.exe.

I have made some changes to the update.php script:
http://www.netjukebox.nl/download/updat ... velop1.zip
But I don't think the problem is there.

I think that your webserver hasen't read and write access to the /home/media directory.

PS
The next netjukebox version will convert _ to space on Linux.
Last edited by wbartels on Sat May 28, 2005 3:02 am, edited 1 time in total.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

This little script may help you to find the problem.
If this script displays the files and/or directories then netjukebox should update.

Code: Select all

<?php
$dir = '/home/media';
$handle = @opendir($dir) or exit('Can\'t open directory: ' . $dir);
while(($entry = @readdir($handle)) !== false)
	echo $entry . "<br>\n";
closedir($handle);
?>
BigBossMan
User
Posts: 33
Joined: Wed Mar 30, 2005 9:27 am
Location: SLC, Utah, USA

Post by BigBossMan »

Couple of things:

The link you have given in the previous post seems to be broken.

This one might be my fault: I placed your code into a blank file as is and linked it to my index.html. Nothing but a blank screen. So I tried editing the code to include proper html tags before and after the php script. Still nothing.

Does this mean I have bigger problems ?

As far as adding access via the web server, thats done with an .htaccess file right?

I set one with the following:

[root@localhost media]# more .htaccess
allow from all
order allow,deny

Thats all it should need, right ?

I am puzzled why the script would not run and the acces list doen't seem to have helped either. Any other options I could purse?

BBM
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

BigBossMan wrote:The link you have given in the previous post seems to be broken.
Now it works :)
BigBossMan wrote:This one might be my fault: I placed your code into a blank file as is and linked it to my index.html. Nothing but a blank screen. So I tried editing the code to include proper html tags before and after the php script. Still nothing.

Does this mean I have bigger problems ?
Do you mean you have renamed all .php files to .html :?
BigBossMan wrote:As far as adding access via the web server, thats done with an .htaccess file right?

I set one with the following:

[root@localhost media]# more .htaccess
allow from all
order allow,deny

Thats all it should need, right ?
On windows there is no need to use a access file with the default Apache installation.
So I guess it isn't either needed for Linux.
I mend file/directory user access the same way how NTFS works on Windows.
I don't know how it is called on Linux.
BigBossMan wrote:I am puzzled why the script would not run and the acces list doen't seem to have helped either. Any other options I could purse?

BBM
Sorry, No other suggestions :(
BigBossMan
User
Posts: 33
Joined: Wed Mar 30, 2005 9:27 am
Location: SLC, Utah, USA

Post by BigBossMan »

Reply:
Thanks for th correcting the link, I got it :D

What I meant about the html tags and the test script was this:
I tried inserting your code to an empty html page named test_script.php, looks like this:
<html>
<head></head>
<body>
<? your code snippit?>
</body</html>
--- and ---
I treid just your code alone without the html part.

Either way a link from index.html to the test_script.php works, but the page displayed is empty. Now the link to NetjukeBox brings (WWW(docroot)/netjukebox/)) works fine. It willl pull up the login dialog box. Anyway, the question is why would you code not run either way, What did I miss?

Concering the file access, if you type the file location in the browser bar, you can access the file fine in folder form, so I guess that it does have access.

Here is one for you however, I renamed update.php to (old)update.php_ moved in your file from the link provided, checked to make sure file access had the same owner and access level as the other files and finally restarted the httpd. Now instead of receiving the directory no found error, the whole pag is displayed as a forbidden error. Why is beyond me. I will continue to mess with this, but what are your thoughts on the forbidden error? All the file in the /var/www/html/netjukebox dir have the same permissions, odd don't you think?

BBM
BigBossMan
User
Posts: 33
Joined: Wed Mar 30, 2005 9:27 am
Location: SLC, Utah, USA

Post by BigBossMan »

OK - I guess I am having some file permission things going on.

I copied the original to update(ORG).php and copied the code afrom your modified update.php into the current, replacing all code.

Long story short, when using the original code I receive the directory not found error.
When I use the modified update.php code I receive a Can't open directory error.

What is different? What was changed in you modifed update.php?
Not sure what to do now.
:?:
BBM
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

BigBossMan wrote:OK - I guess I am having some file permission things going on.
Yes, I think that is the problem.
Sorry I can't help with that.
My Linux knowledge is very limited.
BigBossMan wrote:OK - I guess I am having some file permission things going on.
What is different? What was changed in you modifed update.php?
Not sure what to do now.
:?:
BBM
On the current update version I relied on the chdir() function.
On the upcomming netjukebox (and the above update.php) I use the filename/directory including the full path.
I also fixed a problem on Windows when use the root from the drive or use a NTFS mounting point on some systems.
Guest

Post by Guest »

OK

Moved media from root to /var/www, that seems to have enough permissions to get it to work.

Have found a few wacky things, don't know if it linux or Firefox.

Things like pic of the check marks after the script has ran (update) don't show up, but they do in the user mod script.

But IT IS ALIVE !!!!

BBM
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Anonymous wrote:OK

Moved media from root to /var/www, that seems to have enough permissions to get it to work.

Have found a few wacky things, don't know if it linux or Firefox.

Things like pic of the check marks after the script has ran (update) don't show up, but they do in the user mod script.

But IT IS ALIVE !!!!

BBM
In Holland we say "De aanhouder wint"
This can be translated in something like this "Who doesn’t give up will win".
Very nice it is working now :D

I have now Idea what the problem is with the check marks.
Does the playlist volume and progress bar work?

For security reason I would advice to make a random directory to place the media files in (Linux is case sensitive).
Example: /var/www/qav5t1zia8upo0nk/media/

On the first google result for "linux file rights" I found this website:
http://www.freeos.com/articles/3127/
Maybe it will help you to make the right file permission in another directory.

Now you have Linux running you can do a test for me :wink:
I have made some small changes to format.inc.php to convert _ to spaces.

Code: Select all

//  +---------------------------------------------------------------------------+
//  | Encode Escape Characters                                                  |
//  +---------------------------------------------------------------------------+
function EncodeEscapeCharacters($file)
{
global $cfg;
$file = str_replace('?', '^', $file); // ? to ^
$file = str_replace(';', ':', $file);
if ($cfg['windows'] == false)
	$file = str_replace(' ', '_', $file);
return $file;
}



//  +---------------------------------------------------------------------------+
//  | Decode Escape Characters                                                  |
//  +---------------------------------------------------------------------------+
function DecodeEscapeCharacters($file)
{
global $cfg;
$file = str_replace('^', '?', $file); // ^ to ?
$file = str_replace(';', ':', $file);
if ($cfg['windows'] == false)
	$file = str_replace('_', ' ', $file);
return $file;
}
Would you like to test the above script?
If you find any other strange behavior on Linux please let me know?
BigBossMan
User
Posts: 33
Joined: Wed Mar 30, 2005 9:27 am
Location: SLC, Utah, USA

Post by BigBossMan »

Sorry I haven't responded to this in a while. Work is out of control and the summer quarter is just getting started.

I have updated to 3.74, I see you have included your test in it (I'm guessing). The check mark images thing went away. Your new cover columns setup looks great. Code / scripts seems to run faster too!

I have other questions, but I think I will start a new thread.

If you would like I would be more than happy to do some testing for you. Still trying to finish a few things with this box before I go live with it. Currently working off of my XP machine, which works OK, but would like run this and other web apps on a LAMP environment.

Thanks for the tip about the file permissions thing. Descided to take a Unix/Linux advanced Admin class this summer. Hope I get the rest of this nailed.

BBM
Post Reply