ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
Re: Unable to write to files using CGI
by Alejandro Santillan Iturres other posts by this author
Apr 1 2008 7:01PM messages near this date
Re: Unable to write to files using CGI | Apache and mod_perl question
Well, as /home/anithing/ was no writable even by chmod 777 it, I've  
created a new directory at:
/var/www/server/  and now, the script is able to write to a file  
without problem.

My problem now is that the same script should execute something, and  
it is not doing it.

The script now is:


#!/usr/bin/perl
use CGI;
my $q = new CGI;
print $q-> header();

$user = $q-> param('user');
$pass = $q-> param('pass');

if($user eq "Eduard" && $pass eq "xxxxx"){
$filecontents = $q-> param('filecontents');

#this is the line I replaced ant now the file.txt appears as expected
#open(FILE,"> /home/server/file.txt") or die;
open(FILE,"> /var/www/server/file.txt") or die;
print FILE $filecontents;
close(FILE);

#this is the line that is not working now:
system("wall New_file_written");

#nor this one, which is a call to another script located at /var/www/ 
server/
system("cd /var/www/server\n./executemyfile.pl");

print "hi $user!";
}
else{print "You are not authorized!"}


On Apr 1, 2008, at 12:10 AM, Andy_Bach@[...].gov wrote:

>  I'd be looking at the server's http error log. anything the script  
>  kicked
>  out, msg-wise will be there. You should also put some info in your  
>  'open'
>  stmt's die clause:
>  open(FILE,">/home/server/file.txt") or die;
> 
>  s/b:
>  open(FILE,">/home/server/file.txt")
>     or die "Can't write home/server/file.txt: $!";
> 
> > I don't know if this happens because of the https. I've set the
> > permissions of /home/server dir to 777, and also the same for all
> > files inside the directory, but
> > I cannot write a file inside this directory.
> 
>  This isn't anything important is it? This seems like the worst sort of
>  admin flailing. There's only one file there file.txt that'd matter and
>  /home also needs to be open enough for the user the web server is  
>  running
>  as to be able to see server and file.txt.  Your bare 'die' would put  
>  some
>  msg in the httpd error_log but by adding the info above (the "$!"  
>  would
>  give the human version of the OS error) it may be obvious.   But you  
>  can't
>  do cgi programming w/o the httpd error log.
> 
>  a
> 
>  -------------------
>  Andy Bach
>  Systems Mangler
>  Internet: andy_bach@[...].gov
>  Voice: (608) 261-5738 Fax: 264-5932
> 
>  "It's true that I've driven through a number of red lights. But on the
>  other
>  hand, I've stopped at a lot of green ones I've never gotten credit  
>  for"
>  Glen Gould
> 
>  _______________________________________________
>  ActivePerl mailing list
>  ActivePerl@[...].com
>  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Alejandro Santillan Iturres
Francisco Zarabozo
David Christensen
Bill Luebkert
Andy Bach
Alejandro Santillan Iturres

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved