Solved

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

Posted on 2009-04-13
3
453 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
[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
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
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…

695 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