M
M
Mortech2020-10-19 21:28:09
linux
Mortech, 2020-10-19 21:28:09

How to defeat end of script before headers?

The simplest script itself is under the spoiler. Error in logs: end of script before headers.
I created .htaccess along this path (I also tried deleting .htaccess everywhere) c AddHandler cgi-script .cgi .pl .py
Options +ExecCGI
After switching to loungefirst.ml/cgi-bin/cgi.pl script
500 error.
There are no problems with rights, since I assigned "777" to all folders and files. There are only user rights, but there is no need for root rights in the job condition.

spoiler
#!/usr/sbin/perl
use strict;
use warnings;
use utf8;
use CGI;

my $cgi = CGI->new;
print $cgi->header( -charset => 'utf8', -type => "text/plain" );
print "Hello World!";

I created a question with other tags and about the script itself, but it turned out that it was not perl, since it is displayed in the console, and static (any file, txt, html) is not given along this path loungefitst.ml/cgi-bin/smt .html returns with the same 500 error in the end of script before headers logs

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-10-20
@Mortech

The problem is probably that Apache does not have permission to run applications in /usr/sbin
Try replacing #!/usr/sbin/perl with #!/usr/bin/perl in the first line of the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question