Reading from textfiles on a server

Hey guys, i have a problem. For offline mode i use xitami webserver, when i let my script read and write some lines from/to a textfile it works perfectly. But if i upload it to my server (into cgi-bin of course) it doesnt work. For reading from and writing to files i use the "open" and "print 'some text'" methods

(if they're called methods or functions or

whatever :)

What's the problem? do i do it wrong or is it a server error, or doesnt my server support such commands?

Thnx a lot for any help


  • Hi!

    One thing I noticed when I used to use Xitami for testing (I've moved on to Apache since, as it is used on most of the webservers I host on) is that it isn't quite so worried about HTTP headers as other web servers. Make sure the first text that is printed is done by a line like:

    print "Content-type: text/html


    This should sort it out. Do this before you print any other HTML to the server.

    Also, make sure you are writing data to the file, rather than to the web server! For example:

    open FILE, "
    print "Text"; #This prints to the HTML page.

    print FILE "Text"; #This writes data to the FILE. Note that there is no comma needed.

    close FILE;


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!