Apache CGI in user directory End of script output before headers
Finally I solved that. Thanks to @JimB, because in his comment he pointed out SUEXEC, which I didn't know about (or simply ignored till now).
After reading a bit the suEXEC documentation, I understood the the problem had to be there. So, I took a look at the configuration:
# suexec -V
-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=1000
-D AP_HTTPD_USER="apache"
-D AP_LOG_SYSLOG
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=1000
-D AP_USERDIR_SUFFIX="public_html"
and everything looked Ok (good uid/gid for my user, userdir_suffix is fine, etc). So I took a look at the system logs:
# journalctl -b | grep "suexec"
May 22 11:43:12 caladan suexec[5397]: uid: (1000/user) gid: (1000/user) cmd: test.cgi
May 22 11:43:12 caladan suexec[5397]: directory is writable by others: (/home/user/public_html/cgi-bin)
and that's the problem: my cgi-bin
directory was writable by others.
I fixed by simply changing the permissions to 755
.
End of script output before headers when using Anaconda Python in Apache
The problem was due to the line ending difference in Windows and Linux. The file was in CRLF ending and it should change to LF line ending. My text editor Pycharm has a way of changing it at the bottom right corner or in the File menu as shown below. So chaning it to Unix and OS X line separator fixed the issue.
For more from Pycharm check this link.
If you use git, this is automatically fixed when you commit the repository.
Edit:
I recently found out that making the python file executable is needed. Even if I fixed the line ending, I had a problem and making the file executable by checking the checkbox in file permissions fixed the issue.
End of script output before headers in Apache + PHP
The issue was that the request was timing out before the script completed, due to a long-running database query.
So that generic End of script output before headers
error can be caused by server timeouts as well as file permissions issues.
End of script output before headers when trying to open file on Apache [Cloud9IDE]
As it turns out, fopen cannot accept URLs. I tried editing the code to:
pfile = fopen("../../../home/ubuntu/workspace/files/html/output.html", "w");
and it worked.
End of script output before headers - CGI on Apache
I don't know why you are using $CGI instead of CGI
I think It should be
my $query = CGI->new;
tested on Linux working perfect.
Related Topics
Docker Run Hello-World Still Fails, Permission Denied
Linux Kernel: Kernel Version String Appended with Either ''+" or "-Dirty"
How to Delete/Remove Certificates from Mono Certificate Stores My and Trust
How to Pass Env Variables Between Make Targets
How to Make Ssh Command Execution to Timeout
Setting Process Name (As Seen by 'Ps') in Go
Principle of Qemu CPU Emulation
Using Su/Sudo When Accessing Remote Git Repositories Over Ssh
What Is The Maximum Allowed Depth of Sub-Folders
How to Disable Serial Console(Non-Kernel) in U-Boot
Intercepting File System System Calls
In Linux, How to Find Find Directory with The Most Subdirectories or Files
Ansible: Check If Service Is Listening on a Specific Port
Loop Through Array of Arrays of String with Spaces
Checking Shared Libraries for Non Default Loaders
How to Programmatically Invert Screen Colors in Linux
Gnu Linker: Alternative to -Version-Script to List Exported Symbols at The Command Line
How to Set Control Register 0 (Cr0) Bits in X86-64 Using Gcc Assembly on Linux