A great way to make your cgi script fail is to upload it equipped with Windows type CR/LF settings.
If you see something like this in your web servers error log ...
- [Wed Feb 01 06:24:55 2012] [error] [client 188.8.131.52] suexec failure: could not open log file
[Wed Feb 01 06:24:55 2012] [error] [client 184.108.40.206] fopen: Permission denied
[Wed Feb 01 06:24:55 2012] [error] [client 220.127.116.11] Premature end of script headers: first_test.py
... then it is time to change the CR/LF settings of your file to linux format.
1 blog comments below
But wouldn't the converse be true if you were running on a Win server and had it set up for unix (LF only)? If you write scripts in Python, then I believe you would seldom have a problem with reading, since Python is supposed to automatically adjust to either standard -- as long as it's consistent within any one file! For writing, Python does default to whatever the system setting is. For a desktop system, that almost surely will agree with the type of system Python is running on. I don't know about servers, but probably it would also match the standard for the OS unless an administrator set it differently.
SonLight on Tue Jul 19, 2016 6:01 am