Avatar of bemara57
bemara57

asked on 

My Perl/CGI script executes system commands, but Error 500 on web.

I'm trying to run a Perl/CGI from the web. What's special about this script is that it is calling system commands. The script keeps giving me an internal error but I can't figure out why. Is this allowable to do something like this?

My link is this: <a href="cgi-bin/test.cgi">Click Here</a>

This is my error logs in Apache:
[Tue Feb 27 14:31:08 2007] [error] (8)Exec format error: exec of 'test.cgi' failed
[Tue Feb 27 14:31:08 2007] [error] [client 192.168.1.7] Premature end of script headers: test.cgi

This is my perl script:
#/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
system("cp /tmp/test.txt /tmp/test2.txt");

What am I doing wrong here? I would greatly appreciate any help.
Scripting LanguagesApache Web ServerPerl

Avatar of undefined
Last Comment
bemara57
ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of bemara57
bemara57

ASKER

Geez how clumsy of me, thanks!
Scripting Languages
Scripting Languages

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.

30K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo