Click to See Complete Forum and Search --> : Perl/cgi works at command line


Dizzybacon
06-12-2002, 03:35 PM
I've written a perl script which opens a directory and prints a list of the contents. All very simple.

For some reason it doesn't work when called from a browser, but from the command line it is fine.

I've removed all the extras and this is how the code looks:

#! /usr/bin/perl

print "Content-type:text/html\n\n";

print "<html><head></head><body>";

opendir (MUS,"/home/username/mp3");
@mus = readdir (MUS);
close MUS;

print "$mus[2]\n";
print "</body></html>";


I don't know if I'm just beingblind, but it's driving me insane.

I've checked the permissions on the folder and they are set to 755.

Can someone see what is wrong with this.

Dizzy

Whipping Boy
06-12-2002, 04:12 PM
Do you have Apache configured properly?

Dizzybacon
06-12-2002, 04:28 PM
Pretty sure I do.
Other cgi scripts are working including opening and reading directories.

Dizzy

Dizzybacon
06-12-2002, 04:47 PM
Please ignore this post.

I've worked it out it appears that I'm an idiot!
For some reason, although the permissions on the directory were correct, all the sub directories were owned by root.

Now I've changed this it seems to work again.

Dizzy