Solved

Getting apache server error 500 when trying to run perl script

Posted on 2007-04-05
3
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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…

734 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