Yes, I am running this as a cgi. I called it from a web browser. IE 6 on a PC. Yes, the script has no Mac line endings. I wrote it on a PC using a text editor. I've done nothing different than I have for all my other scripts. I just don't understand. Here is the path:
tonedeaf.redirectme.net/cgi-bin/write.cgi
The script is in the /Library/WebServer/CGI-Executables/ folder. I can get other scripts to run fine, but just can't read or write files. Any ideas you may have would be greatly appreciated.
You simply don't have permission to write to the file. Compare these two:
<http://cgi.bd8.com/cgi-bin/hello.pl>
#!/usr/bin/perl $f = "test.txt" ; $error = "no error" ; $command = "open F, \">$f\" or \$error and close F"; open F, ">$f" or $error = $! and close F ; print <<EOT ; Content-Type: text/html
<h1>$command</h1> <h1>--> $error</h1> EOT #
<http://cgi.bd8.com/cgi-bin/hello2.pl>
#!/usr/bin/perl $f = "test.txt" ; $error = "no error" ; $command = "open F, \"$f\" or \$error = \$! and close F"; open F, "$f" or $error = $! and close F ; $s = <F>; print <<EOT ; Content-Type: text/html
<h1>$command</h1> <h1>--> $error. File Contents: $s</h1> EOT #