-   Linux - Newbie (
-   -   Failed to execute cgi script in Apache!! (

baby_linu 06-30-2004 01:19 PM

Failed to execute cgi script in Apache!!

I wroe a sample cgi program on Apache.But it is not working..!!

I had done the following steps.

1) Edited the httpd.conf file

Directory "/var/www/cgi-bin">
# AllowOverride None
Options +ExecCGI
#Order allow,deny
#Allow from all

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

2)Put the sample script on /var/www/cgi-bin/

3) Change the permissions of /var/www/cgi-bin/ and its contents to 755

But it is not working!!
The error messege displayed by the browser is (when the URL is

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster
Error 403

When typing the URL as
the error messege is

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster
Error 404

What is the problem ??? Help me
:confused: :confused:

Donboy 06-30-2004 01:44 PM

Look at your error logs. Usually you can just look around your config file and find the various places for your error log. Open that file and see what apache says about it. Anytime apache gives an error, there is a relavent line written in the log about it. Usually this will tell you the problem. If that doesn't seem to help, maybe try posting your config file for everyone to see.

baby_linu 06-30-2004 01:53 PM

The condition is improving!!
One problem is solved!!
the problem was i added the ScriptAlias directive after setting the cgi-bin directory.
Now the error messege is changed

Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
Premature end of script headers:

If you think this is a server error, please contact th

Thank u
:confused: :confused:

Donboy 06-30-2004 02:22 PM

Is that the message shown in the error log as well? Maybe post the script you're trying to run so we can see what might be wrong with it. Also be sure your script is in unix format and not PC format. Unix format uses line feeds -- PC format uses carriage returns. If you created this file on the PC, it likely has CR so you just need to change them to LF's.

baby_linu 06-30-2004 05:23 PM

Thank u fro ur reply... the problem is now solved... now i can execute sample cgi programs

All times are GMT -5. The time now is 07:26 PM.