Solved

Getting apache server error 500 when trying to run perl script

Posted on 2007-04-05
3
228 Views
Last Modified: 2010-03-04
Ok to start with, I am using apache2triad on a windows server 2003 web edition os.  It has apache 2.2.0 and perl 5.8.7 in it.  The first problem I was having is that anytime I would try to execute a perl script from a web browser, it would try to download the file.  I went to the apache2triad control panel and tried to run the mod_perl test, and it also wants to download the file instead of executing it.  So thenI changed the extension on my perl script from .pl to .cgi.  As soon as I did this, I got this message:

Server error!
The server encountered an internal error and was unable to complete your request.

Error message:
couldn't create child process: 720003: copy.cgi

If you think this is a server error, please contact the webmaster.

Error 500

When I looked at the error log for apache, I found this:
[Thu Apr 05 14:45:23 2007] [error] [client 172.16.90.137] (OS 3)The system cannot find the path specified.  : couldn't spawn child process: C:/apache2triad/htdocs/revolve/copy.cgi

It looks to me like it is having a problem with the directory I gave it.  Also, I can run my perl script just fine outside of apache.  It will copy the file over just like it is supposed to.  It only has a problem when I try to access it from my browser.    This is my perl script:

#!C:\apche2triad\perl\bin\perl.exe
use CGI::Carp qw (fatalsToBrowser);
use File::Copy;

print "content-type: text/html \n\n"; #The header
$filetobecopied = "c:/testfile.txt.";
$newfile = "z:/testfilemoved.txt.";
copy($filetobecopied, $newfile) or die"Could not copy $filetobecopied.";

I have  been stuck with this for a few days now and I cannot seem to find anyone that knows what is going on.  Any help would greatly be appreciated.  
0
Comment
Question by:grizzly_adams
3 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
Comment Utility
Is this really the path to your perl?

#!C:\apche2triad\perl\bin\perl.exe

Or are you missing an 'a' in there?
0
 

Author Comment

by:grizzly_adams
Comment Utility
Well it looks like I simply left out the 'a' on apache lol.  I can't believe I missed that one.  Now all I get is a simple error telling me "software error: could not copy".  So I guess this problem was really a simple one.  Thanks alot clockwatcher.
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
Make sure you change

copy($filetobecopied, $newfile) or die"Could not copy $filetobecopied.";

to

copy($filetobecopied, $newfile) or die"Could not copy $filetobecopied $!\n";

$! will contain the OS reason why the copy failed.  Probably due to permissions.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now