You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rene Büdinger <rb...@wz.ag> on 2002/06/19 17:28:34 UTC
Problems with Scripts generating / deleting Files in the Webspace
Hi Group,
we migrated one of our Webservers from IIS 5.0 to a SuSE Linux System with
Apache and installed mod_perl. Most of the Perl Scripts work fine. But we
have some scripts for our co-workers to update some HTML Pages via a Form
generated by a Perl Script.
Directory Constellation:
Perl Scripts are under: /usr/local/httpd/cgi-bin/
The Homepage is under: /usr/local/httpd/htdocs/
The htdocs Directory is protected via a .htaccess File. So if somebody wants
to access the Homepage on the Server he has to authenticate first. This works
fine.
Under the Directory of the Homepage, there is another Directory called
"news". Here are many .html Files which are the "News" we want on our
Homepage.
Now, the co-workers call a Admin Script with
"http://<servername>/cgi-perl/admin.pl" which displays a Form. With this
Form, the News is entered and submitted. This Form now calls a Perl Script
within the cgi-bin (aka cgi-perl) Folder which should generate a new .html
File under /usr/local/httpd/htdocs/news. But whenever this Script runs I get
an Error Message in the error_log from Apache.
The Error Message says that the File could not be generated. I first thought,
this is because of some rights the Script doesn´t have. So I tried to set a
777 to the news Directory. But I still got this Error.
Is it "forbidden" for a Script to access the /usr/local/httpd/htdocs/*
Folders, even if the rights are set correctly on a Standard Apache
Installation? More than 777 can´t be done, so I think I must search my Error
somewhere within the Config Files or it has something to do with the
Authentication set to the htdocs Directory?
Sorry for my bad English, but I hope you can understand the problem
description. I also hope that I am right here in the mod_perl Group (because
I am not sure if it is a mod_perl or Apache issue) :-/
Thank you very much in advance for your help!
cu...
buedi!
Re: Problems with Scripts generating / deleting Files in the Webspace
Posted by Stas Bekman <st...@stason.org>.
Rene Büdinger wrote:
> Hi Group,
>
> we migrated one of our Webservers from IIS 5.0 to a SuSE Linux System
> with Apache and installed mod_perl. Most of the Perl Scripts work fine.
> But we have some scripts for our co-workers to update some HTML Pages
> via a Form generated by a Perl Script.
>
> Directory Constellation:
>
> Perl Scripts are under: /usr/local/httpd/cgi-bin/
> The Homepage is under: /usr/local/httpd/htdocs/
>
> The htdocs Directory is protected via a .htaccess File. So if somebody
> wants to access the Homepage on the Server he has to authenticate first.
> This works fine.
>
> Under the Directory of the Homepage, there is another Directory called
> "news". Here are many .html Files which are the "News" we want on our
> Homepage.
>
> Now, the co-workers call a Admin Script with
> "_http://<servername>/cgi-perl/admin.pl_
> <http://<servername>/cgi-perl/admin.pl>" which displays a Form. With
> this Form, the News is entered and submitted. This Form now calls a Perl
> Script within the cgi-bin (aka cgi-perl) Folder which should generate a
> new .html File under /usr/local/httpd/htdocs/news. But whenever this
> Script runs I get an Error Message in the error_log from Apache.
>
> The Error Message says that the File could not be generated. I first
> thought, this is because of some rights the Script doesn´t have. So I
> tried to set a 777 to the news Directory. But I still got this Error.
in the future please copy-n-paste the error message instead of
interpretting what it was.
> Is it "forbidden" for a Script to access the /usr/local/httpd/htdocs/*
> Folders, even if the rights are set correctly on a Standard Apache
> Installation? More than 777 can´t be done, so I think I must search my
> Error somewhere within the Config Files or it has something to do with
> the Authentication set to the htdocs Directory?
most likely the script has no permissions to access/write parent
directories, and if that's the case it doesn't matter what you set your
news directory to, it won't have a chance to reach there. The best way
to do this kind of testing is this:
Let's say that your server is running under user 'httpd', which has the
password disabled.
% su (become root)
% su - httpd
% cd /usr/local/httpd/htdocs/news
% touch test
if this works, your server should be able to do the same, if not, check
the perms of the parent dirs (i.e. /usr/local/httpd/htdocs,
/usr/local/httpd, etc)
> Sorry for my bad English, but I hope you can understand the problem
> description. I also hope that I am right here in the mod_perl Group
> (because I am not sure if it is a mod_perl or Apache issue) :-/
It's pretty much a generic Apache (or even just generic Unix) issue, but
this is common enough to bite mod_perl users.
Another approach for debugging this kind of problem is to use strace(1)
or its equivalents. e.g. see:
http://perl.apache.org/release/search/swish.cgi?query=strace&sbm=docs%2F1.0&submit=search
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com