Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Clearly lost my mind

by jerrygarciuh (Curate)
on Jan 06, 2008 at 04:17 UTC ( #660623=perlquestion: print w/ replies, xml ) Need Help??
jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Telewest server crashed, it would seem, for good. Have spent days and days migrating 5 & 6 database driven sites per day to Dreamhost. Between the servers there are some quirks and changes one of which caused me to write this tiny script to zip up some files so client can collect at will. But I am getting premature end of script headers from it from browser. It compiles and runs fine from command line, makes the zip and all. Have I lost it?

Host is running linux, perl, v5.8.4.

#!/usr/local/bin/perl -w use strict; my $rm = `rm /home/sumsite/public_html/foo/admin/cd.zip`; my $cmd = `zip -q -r ./cd cd`; print "Location: http://www.sumsite.com/foo/admin/cdZip.php\n\n";

I'm going to dream about this tonight!

Sat Jan 05 19:58:04 2008 error client 11.111.111.111 Premature end of script headers: cdZip.pl

Any help greatly appreciated!

jg
_____________________________________________________
"Transport of the mails, transport of the human voice, transport of flickering pictures - in this century, as in others, our highest accomplishments still have the single aim of bringing people together."   Wind, Sand, and Stars
  Antoine-Marie-Roger de Saint-Exupery

Comment on Clearly lost my mind
Download Code
Re: Clearly lost my mind
by jdporter (Canon) on Jan 06, 2008 at 04:22 UTC

    One possibility: Backticks only captures stdout; if either of those spawned programs print anything to stderr, it's going to be captured by the web server as output from your program. You might try redirecting stderr of the two spawned programs. I notice you don't do anything with the stdout that you catch in both cases. Perhaps it would be better to redirect stdout/stderr to log files instead?

    A word spoken in Mind will reach its own level, in the objective world, by its own weight
      Thx jdporter,

      I think I must be delirious. I added

      use CGI::Carp qw( fatalsToBrowser ); use Fatal qw( warn ); use strict; use warnings;
      and suddenly it works. Dunno. Must.sleep.

      Thx very much! jg

      > _____________________________________________________
      "Transport of the mails, transport of the human voice, transport of flickering pictures - in this century, as in others, our highest accomplishments still have the single aim of bringing people together."   Wind, Sand, and Stars
        Antoine-Marie-Roger de Saint-Exupery

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://660623]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2014-10-31 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (214 votes), past polls