1748112 Members
3494 Online
108758 Solutions
New Discussion юеВ

Re: unix and cgi scripts

 
Shibin_2
Honored Contributor

unix and cgi scripts

Hi,

I have recently migrated a web-based application from one server to another server. At first look, there is no problem because, I can see the web-page and can navigate to other html pages. At one section, we uses a cgi script and the front page of cgi script is visible. Inside that script, there are several important scripts, which are not at all functioning.

How can I check or debug this cgi script for the consistency and how do I determine, which module is not functioning? Any idea.

My httpd.conf allows all for cgi execution (shown below); but the script somehow is not functioning.

ScriptAlias /cgi-bin/ "/apache/cgi-bin/"


Allowoverride None
Options None
Order allow,deny
Allow from all


AddHandler cgi-script .cgi

Regards
Shibin
12 REPLIES 12
Steven Schweda
Honored Contributor

Re: unix and cgi scripts

> [...] the front page of cgi script is
> visible. [...]

Do you mean you are seeing the script itself,
not the expected output from running the
script?

> [...] from one server to another server.

> My httpd.conf [...]

What's different between the two servers?
httpd.conf? Other files it might include?
File ownership? Permissions?
Shibin_2
Honored Contributor

Re: unix and cgi scripts

The web page starts with index.html, which loads properly, no problem. Then, it has two modules.

1. Goes to useradmin.cgi
2. goes to other functions.

Both modules load properly and second modules work perfectly, since that module has only minimal scripts/functions.

Useradmin.cgi module loads as expected, but inside that different scripts, functions, which calls to different cgi scripts as well as UNIX commands. These are not functioning. I have copied all the files from the earlier server and just pasted here on the same location.

I don't think so, it is a permission issue, because, most of the file has 755 permission. Both servers using the same apache, httpd.conf and other files.

Can I debug this useradmin.cgi script using any tools ?
Regards
Shibin
Dennis Handly
Acclaimed Contributor

Re: unix and cgi scripts

>Can I debug this useradmin.cgi script using any tools?

Is it perl or a shell script?
Shibin_2
Honored Contributor

Re: unix and cgi scripts

Perl

Pls have a look on the attached script.
Regards
Shibin
Binu George
Advisor

Re: unix and cgi scripts

Shibin,

I notice that the script attached has a blank first line.
CGI scripts should have the interpreter as the first line (in this case #!/opt/perl/bin/perl)

--Binu
Shibin_2
Honored Contributor

Re: unix and cgi scripts

Hi Binu,

The perl interpreter is in proper position. There is no problem in that.
Regards
Shibin
Binu George
Advisor

Re: unix and cgi scripts

Shibin,

One place to look would be the apache error logs (/opt/hpws/apache/logs/error_log on HP-UX).
Any script error and failures are logged in this file. This information should help debug your script.

--Binu
Shibin_2
Honored Contributor

Re: unix and cgi scripts

Hi Binu,

There is no error reporting in apache error log. Only notice.

I was checking this for each activity. Unfortunately, no errors reported. Some how the script is not functioning properly.

Thanks
Regards
Shibin
Binu George
Advisor

Re: unix and cgi scripts

Sibin,

A silly question. Did you restart apache after adding the "ScriptAlias"?
Also, what is the exact message you see on your browser?

--Binu