|
| Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Join Date: Jan 2002
Posts: 223
Reputation: 53
|
Premature end of script headers error on a TEXT file
Okay guys, this has to have a simple answer *smile*
I am using php to open and append text to a text file in my cgi-bin, but I am getting the dreded -Premature end of script headers- on the txt file itself. Yes, I uploaded the empty txt file in ASCII, with permissions 755 - do I have to have something, header wise, in the text file? |
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
Try setting your text file to 644 or 664
~nan |
|
|
#3 |
|
Join Date: Nov 2001
Location: CA
Posts: 3,874
Reputation: 6
|
Yep, need to make the .txt file writable. Either 766 or 777.
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
SimCo, is the higher permissions number a PHP-thing? What I know about PHP, you could fit on the fingernail of my pinky finger.
All the Perl scripts I've used (except one) require a 644/664 permission for text files... even the ones that are written to, so this is where I'm coming from. When I've tried higher numbers than that, they generally don't work. |
|
|
#5 |
|
Join Date: Jan 2002
Posts: 223
Reputation: 53
|
CMOD
When using WS_FTP LE I find that I cannot change the file permissions on just one file without all other files and the directory itself also changing to match. Is this a problem with the LE version, or is this only happening to me?
Anyone else heard of this type of problem? |
|
|
|
|
#6 |
|
Guest
Posts: n/a
|
The program shouldn't actually be changing all of the files in the directory, but when you select one of the other files, then right-click and select CHMOD, it will show you which permission you last used. Is that what you are looking at?
A better way to tell if it's actually changing permission is to click on the DirInfo button and look at the permissions file for a particular directory. |
|
|
#7 |
|
Join Date: Jan 2002
Posts: 223
Reputation: 53
|
Good news and Bad news
The good news is that I see that you are right about setting the file permissions using WS_ FTP and then checking them using DirInfo - Thanks
The bad news is even after I set the permissions to 777 on my txt file I still see this in my error log: Premature end of script headers: /www/g/gcm345/cgi-bin/orders.txt plus this on the page that opens when I run my php file: Warning: fopen("http://www.garycarpenter.org/cgi-bin/orders.txt", "a") - Undefined error: 0 I have been told that fopen is having trouble opening my orders.txt file because of permissions too, but this can't be true when I set the permissions to 777. Any other ideas? |
|
|
|
|
#8 |
|
Join Date: Nov 2001
Location: CA
Posts: 3,874
Reputation: 6
|
Jami , try moving the text file 'outside' the cgi-bin. Perhaps make a folder for it under your /htdocs directory called 'data' and point the path in the script to the file there like this:
www/g/gcm345/htdocs/data/orders.txt Then, set permissions on the /data folder and the .txt file to 777. Let's see what happens. Saysme , in regards to the PHP permissions, the only files that need chmod (normally) are the ones called directly from the browser (ex: index.php). They should have chmod to 755 and have the #!/usr/local/bin/php line at the top of the script page for each one called directly. For other 'writeable files' as you asked above, I find that 666 can work. The problem is, it's the sign of the devil and reminds me of my ex So I use 777 instead. All lucky numbers ![]() |
|
|
|
|
#9 |
|
Guest
Posts: n/a
|
Originally posted by SimCoWeb:
>>Saysme, in regards to the PHP permissions, the only files that need chmod (normally) are the ones called directly from the browser (ex: index.php). They should have chmod to 755 and have the #!/usr/local/bin/php line at the top of the script page for each one called directly.<< Ah, okay... thanks. >>For other 'writeable files' as you asked above, I find that 666 can work. The problem is, it's the sign of the devil and reminds me of my ex So I use 777 instead. All lucky numbers <<Heh.... good one. ![]() Many of the Perl scripts I've got are specific about calling for a 644, 664, or 666 (lower, the better for security.... but whatever you can get to work for you). On these scripts, if I blow it and accidently change them to 755/777, they don't work at all until I change them to the sixes. So.... that's where I was coming from. Fun stuff, huh? ;-) |
![]() |
| Thread Tools | |
|
|