I am trying to make a Perl script with arguments that can be executable via a web page. Can someone help me with getting started with the apache and the configurations for that? I've tried for multiple hours but nothing seems to work. I'm using Apache 2.4.29
-
What steps did you try in the multiple hours?choroba– choroba2021-03-21 20:36:12 +00:00Commented Mar 21, 2021 at 20:36
-
Maybe this question helps stackoverflow.com/q/8994348/1741542Olaf Dietsche– Olaf Dietsche2021-03-21 20:37:09 +00:00Commented Mar 21, 2021 at 20:37
-
So I am trying to make it so it go to "localhost/cgi-bin/first.pl" but I keep getting apache errors and right now it tells me 403 ForbiddenzAndrewi– zAndrewi2021-03-21 20:38:23 +00:00Commented Mar 21, 2021 at 20:38
-
Searching for apache cgi 403 gives stackoverflow.com/q/32416046/1741542Olaf Dietsche– Olaf Dietsche2021-03-21 20:40:51 +00:00Commented Mar 21, 2021 at 20:40
-
To narrow the reason for the 403 error, look into Apache's log files: /var/log/apache2/access.log and /var/log/apache2/error.log.Olaf Dietsche– Olaf Dietsche2021-03-21 20:43:11 +00:00Commented Mar 21, 2021 at 20:43
|
Show 9 more comments
1 Answer
An option to solve this still using perl is creating a small TCP service running in localhost in the server where you can send your parameters, and then you just configure a reverse proxy in apache to that port.
Example:
use strict;
use warnings;
use IO::Socket;
my $port = 9999;
my $server_socket = IO::Socket::INET->new(
LocalPort => $port,
Listen => SOMAXCONN,
Proto => 'tcp',
Reuse => 1)
or die "Cannot open socket: $!";
print "Server listening on port $port\n";
while ( my $client_socket = $server_socket->accept() ) {
my $client_host = $client_socket->sockhost();
run_your_stuff();
$client_socket->close();
}
sub run_your_stuff{
print "Executing something...\n";
system("ping google.es");
# system("perl your_oder_script.pl");
}