Solved

Getting (2)No such file or directory while trying to run a CGI File

Posted on 2009-04-13
3
449 Views
Last Modified: 2013-12-25
I have a working CGI Script that when served in a browser generates a cookie.  As I needed to have a very similar script, I've made a copy with slight changes, and renamed the file.  

However, although I can run the original fine, when I try to run the new one, I get a blank browser screen.  System Error logs show (2)No such file or directory: exec of ... failed.

File permissions/ownerships are the same on the two files, and the filename is correct.
0
Comment
Question by:ratrace311
  • 2
3 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 24131099
From the error, it appears that this script is trying to execute another program, and that is what is failing.  Can you attach the file?  Do the error logs give you a line number?
0
 

Author Comment

by:ratrace311
ID: 24131211
Here are the files.  They normally run embedded in image tags, but seem to run ok if I call them directly.

i.e.
Works ok:
http://www.247realmedia.com/cgi-bin/nph-opt_out.cgi

Produces the error:
http://www.247realmedia.com/cgi-bin/nph-247realmedia_opt_out.cgi

both domains (realmedia.com and 247realmedia.com) are the same server, and the different cookie domains are set from the image call, when these scripts are called from a website

i.e.
http://www.247realmedia.com/EN-US/opt-out-test.html
nph-opt-out.txt
nph-247realmedia-opt-out.txt
0
 

Accepted Solution

by:
ratrace311 earned 0 total points
ID: 24132447
Ok, so I've figured it out!  
As the files were updated on a Windows machine, it appears that there were dos characters somewhere in the file.

Running the cgi file from the command line:
> ./nph-247realmedia-opt-out.cgi
showed an error of bad interpreter: No such file or directorybin/perl

though the first line of the cgi file shows as #!/usr/bin/perl

The following steps solved the problem:
1) dos2unix FILENAME  ---> resets owner and permissions
2) chown xxx:xxx FILENAME (to correct ownership)
3) chmod 775 FILENAME


0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
The viewer will learn how to dynamically set the form action using jQuery.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

828 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