Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting apache server error 500 when trying to run perl script

Posted on 2007-04-05
3
Medium Priority
?
235 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 2000 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans

730 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