When your CGI script runs online it runs as the default web user 'web' or someone similar. When you run your script from the command line and it works are you running your script as the default web user 'web'?
If the script fails from the command line when run as the web user then that is the source of your problem. You need to grant the appropriate rights to the web user.
Another source of the problem you describe can occur when the web user has the appropriate rights, but there is an existing tower.345 file that was created during testing by a privileged user such as root. In that case your program might fail because the web user does not have the rights to blow away a file owned by a privileged user.
In my experience, it-runs-from-the-command-line-but-not-online CGI problems are most often caused by the default web user having insufficient rights. Give the web user sufficient rights to run the program and the problem goes away.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.