Solved

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

Posted on 2009-04-13
3
439 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

16 Experts available now in Live!

Get 1:1 Help Now