Hi,
I am trying to create text file in specific folder, write in it something , read it for checking, then delete it.
But at very first step I got error.
1. Creating file problem:-
Here is cgi perl script:-
Got error
print() on closed filehandle $fh at /usr/lib/cgi-bin/login.cgi line 22 (#1)
(W closed) The filehandle you're printing on got itself closed sometime
before now. Check your control flow.
[Sat Dec 12 11:33:12 2015] [debug] mod_deflate.c(700): [client xxx.xxx.xxx.xxx] Zlib: Compressed 116 to 85 : URL /cgi-bin/login.cgi, referer: http://xxx.xxxx.xxx.xxx/
2. Deleting existing file:-
I used 4 different ways for already existed file.(I create text file & give it to 777 permission so I can see after command 'ls -al' in terminal is as '-rwxrwxrwx' for hello.txt ).
2.1 by 'unlink'
Then I got following output:-
file Removed successfully by unlink '/home/hello.txt' Permission denied
& Error as follows:-
[Sat Dec 12 11:45:25 2015] [debug] mod_deflate.c(700): [client xxx.xxx.xxx.xxx] Zlib: Compressed 138 to 112 : URL /cgi-bin/login.cgi, referer: http://xxx.xxx.xxx.xxx/
2.2 By `$command`
Then I got following error:-
Can't exec "del": No such file or directory at /usr/lib/cgi-bin/login.cgi line
13 (#1)
(W exec) A system(), exec(), or piped open call could not execute the
named program for the indicated reason. Typical reasons include: the
permissions were wrong on the file, the file wasn't found in
$ENV{PATH}, the executable in question was compiled for another
architecture, or the #! line in a script points to an interpreter that
can't be run for similar reasons. (Or maybe your system doesn't support
#! at all.)
[Sat Dec 12 12:50:36 2015] [debug] mod_deflate.c(700): [client xxx.xxx.xxx.xxx] Zlib: Compressed 159 to 122 : URL /cgi-bin/login.cgi, referer: http://xxx.xxx.xxx.xxx/
2.3 by exec
Then I got following error:-
Statement unlikely to be reached at /usr/lib/cgi-bin/login.cgi line 13 (#1)
(W exec) You did an exec() with some statement after it other than a
die(). This is almost always an error, because exec() never returns
unless there was a failure. You probably wanted to use system()
instead, which does return. To suppress this warning, put the exec() in
a block by itself.
(Maybe you meant system() when you said exec()?)
Can't exec "del": No such file or directory at /usr/lib/cgi-bin/login.cgi line
12 (#2)
(W exec) A system(), exec(), or piped open call could not execute the
named program for the indicated reason. Typical reasons include: the
permissions were wrong on the file, the file wasn't found in
$ENV{PATH}, the executable in question was compiled for another
architecture, or the #! line in a script points to an interpreter that
can't be run for similar reasons. (Or maybe your system doesn't support
#! at all.)
[Sat Dec 12 12:52:40 2015] [debug] mod_deflate.c(700): [client xxx.xxx.xxx.xxx] Zlib: Compressed 159 to 121 : URL /cgi-bin/login.cgi, referer: http://xxx.xxx.xxx.xxx/
2.4 by system command
Then I got following error:-
Can't exec "cd": No such file or directory at /usr/lib/cgi-bin/login.cgi line
12 (#1)
(W exec) A system(), exec(), or piped open call could not execute the
named program for the indicated reason. Typical reasons include: the
permissions were wrong on the file, the file wasn't found in
$ENV{PATH}, the executable in question was compiled for another
architecture, or the #! line in a script points to an interpreter that
can't be run for similar reasons. (Or maybe your system doesn't support
#! at all.)
Can't exec "m": No such file or directory at /usr/lib/cgi-bin/login.cgi line 13 (#1)
(W exec) A system(), exec(), or piped open call could not execute the
named program for the indicated reason. Typical reasons include: the
permissions were wrong on the file, the file wasn't found in
$ENV{PATH}, the executable in question was compiled for another
architecture, or the #! line in a script points to an interpreter that
can't be run for similar reasons. (Or maybe your system doesn't support
#! at all.)
[Sat Dec 12 12:55:27 2015] [debug] mod_deflate.c(700): [client xxx.xxx.xxx.xxx] Zlib: Compressed 158 to 120 : URL /cgi-bin/login.cgi, referer: http://xxx.xxx.xxx.xxx/
I am so much confuse how to create text file & Delete it!
Need Expert guidance!