Debugging internal server errors (premature end of script headers) part 2
Let's start at the very beginning...
If you've installed your script, these are the steps you should have gone through (if not, check them now, this is the first stage of your troubleshooting!!)Check your logs!
Here's where I tell you - check your error logs. I know, I'm not supposed to have told you that - it's what everyone says. A good place to start is to see if the script is dying due to server limitations. Check in the file manager for your website to see if your logs are viewable through there. Check for a 'logs' directory in ftp. Hopefully you've got some somewhere. Check for a line which says 'out of memory', if it's the script you're trying to install, don't bother going any further. You can't fix it, unless you bug your host to lift the memory limits on scripts. Your best bet is to find another script which isn't so heavy on memory. How will you know which ones don't use much memory? You won't. Install it and you will know.Of course, you might find a message in your logs which tells you exactly what's wrong with your script. If so, fix it, and don't bother reading any further!If all you can see is 'premature end of script headers' - read on. We're going to try to solve that one.
Chmod (file permissions)
For .cgi/.pl extensions:Some servers run scripts under permissions of 755, others use 777. In your ftp program, scroll across to the right if you can't see the 'attributes' list for each file. Next to the .cgi or .pl script, it should have something like this:
for 755: -rwx-r-xr-x for 777: -rwxrwxrwx |
-rw-r--r-- |
For .txt/.db extensions or any files that get written to by the script:
Files that get written to by the script need to have permissions set so anybody can write to them. The setting for this is 666. How this will look in your ftp program:-rw-rw-rw- |
So how do you change them?
Through an ftp program is the easiest. Right click on the file you wish to change permissions for, and choose 'CHMOD' from the dropdown list. A box will pop up, with 'owner permissions', 'group permissions' and 'public permissions'. Your ftp program may be a little different in what it says, but I'm sure you'll work out which is which.For chmod 666, you need to set the following permissions:
owner: read, write. group: read, write. public: read, write. |
For chmod 755, you need to check the following boxes:
owner: read, write, execute. group: read, execute. public: read, execute. |
For chmod 777, you need to set the following permissions:
owner: read, write, execute. group: read, write, execute. public: read, write, execute. |
* handy hint: use your ctrl button to select several files at once, and you can chmod them all at the same time
* another handy hint: some ftp programs aren't set to refresh the list after you've changed something, so it will look like the chmod didn't work. Refresh your list in ftp to see the changed settings (there should be a 'refresh' button somewhere)
So how do you know whether to set the chmod to 755 or 777? Check any help files where you signed up for your website - a faq, forum, whatever. You may find the information in there somewhere. If not, then it's a case of working it out which we'll try to do on the next page.