Solved

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

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

770 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