Solved

Getting apache server error 500 when trying to run perl script

Posted on 2007-04-05
3
231 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
ID: 18862098
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
ID: 18863955
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
ID: 18879984
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…

685 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