Welcome to the Monastery | |
PerlMonks |
Re: CGI script cannot create file.by blue_cowdawg (Monsignor) |
on Dec 18, 2012 at 15:05 UTC ( [id://1009392]=note: print w/replies, xml ) | Need Help?? |
You'll notice I've added the die $!; to your open statement. This eliminates some of the guesswork and worst case will emit to your servers's log files some form of error that you can use to determine what happened. More commentary: Most web servers (Apache, IPlanet, whatever the hell Microsoft publishes these days) run CGI scripts as a restricted or trivial user. Some common userids under *nix that this happens as are as follows:
I am not a big fan of using relative paths when opening a file for writing. There exists a danger that you end up writing the file someplace you don't expect. For instance if you CGI script is running as yourself (rare occasion) but the current working directory the script is running at is somewhere you don't have write access your code is going to bomb. Lastly... I'm not sure what you are trying to accomplish here. Writing passwords to a file has attendant dangers. Make sure the permission bits on the file are restrictive enough to prevent prying eyes for looking at it. Having a CGI script write those passwords is an even worse idea. Gives hackers something to shoot at. Peter L. Berghold -- Unix Professional Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
In Section
Seekers of Perl Wisdom
|
|