in reply to print result in text/html file-perl cgi

When you say "execute through the browser", I presume you mean "send a request to a web server that happens to be running on the same machine" -- i.e. the machine you're using when you execute the script as a shell command. Or at least, you're using a network where both your shell and the web server are able to access the same directory path.

If that's not true, then that's you're problem. But if it is true, then the problem is probably due to permission settings on the directory (and on the file "test.html", if it happens to exist already when you "execute through the browser"): you probably own the directory (and the file), but the web server that executes your script "through the browser" is not a process owned by you, and that process owner would need to be granted write-access to the directory (and to the file, if it already exists).

Bear in mind that there are risks involved when granting such permissions to processes that run via a web server. Assuming that your system is managed by one or more qualified sysadmins, they would (and should) have something to say about the code you are running on your web server, when this sort of access is involved. (For example, they might advise that the writing of data files by the server be restricted to a specific path that isn't in your own home directory.)

  • Comment on Re: print result in text/html file-perl cgi

Replies are listed 'Best First'.
Re^2: print result in text/html file-perl cgi
by myfrndjk (Sexton) on Jul 31, 2014 at 00:40 UTC

    Hi thanks that is due to permission issue