July 18th, 2000, 05:23 PM
i'm trying to make a new file using this script...
open(COUNT,">count.txt") | | &error("can't make new user count file.n");
print COUNT "1|1|10";
...it makes the file but then when i use my FTP client the files don't show up in the directory. i know that they are there because another script reads the file. i just can't view them or delete them. anyone know how to fix this or a better way of making a new file?
July 18th, 2000, 06:16 PM
Your code is fine but your count.txt seems to be reside in the same directory as your script. So you should move it elsewhere for one reason which I will explain why in a moment and give it a full directory path like this:
$count_file = "/server/path/to/count.txt";
open(COUNT,">$count_file") | | &error("can't make new user count file.n");
Also add this line after close(COUNT);
chmod 0666, "$count_file";
Your count.txt coexists with your cgi script will cause you permission problem. Let say your cgi script is in cgi-bin directory, its permission should be 755 (drwxr-xr-x). But "/server/path/to/", the /to directory should be chmodded 777 (drwxrwxrwx) in order to increment the count (assuming your webserver is run as nobody).
>>but then when i use my FTP client the files don't show up in the directory.
What is your webhost? It seems to me the webserver and ftp server are on a separate machines and they are using "rsync" to synchronize the FTP contents to the web. In other words, they do not have the same server path. "rsync" is kinda like NFS and it should be used for backup purpose.
Well, I may guess wrong but you should check with your webhost immediately. I would switch host if they don't put ftp server and webserver on the same machine.
July 18th, 2000, 08:01 PM
thanks for the help with file making part. i now have it make the files in a different directory but i still can't view them. my domain is hosted by jumpline.net. i'm not sure about their web server and ftp server being on different machines. i guess i'll look around their page and see if it says anything about it. thanks
July 18th, 2000, 11:32 PM
You can easily tell if they are on the same machine.
1) Upload test.txt to /serverpath/to/username/some_dir/
2) chmod /some_dir 777
3) chmod test.txt 666
4) test.txt is a blank file
5) Upload test.cgi or test.pl to your cgi-bin directory and chmod it 755
6) your test.cgi should look like:
$test_file = "/serverpath/to/username/some_dir/test.txt";
print WRITE "hellon";
print "Content-type: text/htmlnn";
7) then quickly login via FTP and view the content of test.txt and see if it shows "hello" (without quotes).
8) if it doesn't, don't wait any longer, switch host immediately. If it does but with DELAY, switch host, too.
Another cause of your problem could be if the path to the ftp directory of your account is not the same as the path to your web account, though on the same machine.