Prob with configuring CGI.
Hi , Well I have started with CGI, 2 days back. But some aspects makes me confused. I am having Apache server over Redhat linux 6.2. I put my .cgi files in proper directory configured in access.conf, to, /home/httpd/cgi-bin Group access set in httpd.conf is none. Access rights set to 755 to all .cgi files. If I execute perl -cw something.cgi, It gives message as Syntax OK. If I execute perl something.cgi over command prompt, the scipt gets executed. Now problem is some of these scripts when called thr' browser gets executed, but others wont. Those scripts which cannot be executed successfully over browser, gives error message as, "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request." And the funniest part is, those which called thr' browser, gives error, can execute over command prompt successfully. Also there is no Qn of wrong URL. Because some of other CGIs execute properly, which are in the same directory, as these are. I can show you this script for a CGI, which cannot be executed over browser, #!/usr/bin/perl print "Content-type:text/html\n\n"; print "Test Page"; print "Hello World"; print "\n"; But the same code with different .cgi filename, in the same directory executes. Both are having same access rights. As well setting in access.conf is, # /home/httpd/cgi-bin should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # Options ExecCGI -> +ExecCGI *** BY VIKRAM -> This setting I found from one site # Added AddHandler cgi-script .cgi *** BY VIKRAM -> This setting I found from one site AllowOverride None Options +ExecCGI AddHandler cgi-script .cgi Also there is one more setting in srm.conf, is # To use CGI scripts: # Uncommented the following line AddHandler cgi-script .cgi Do I need anything other than this ? waiting for your reply, from, vikram. _ Chat with your friends as soon as they come online. Get Rediff Bol at http://bol.rediff.com
Prob with configuring CGI.
Hi , Well I have started with CGI, 2 days back. But some aspects makes me confused. I am having Apache server over Redhat linux 6.2. I put my .cgi files in proper directory configured in access.conf, to, /home/httpd/cgi-bin Group access set in httpd.conf is none. Access rights set to 755 to all .cgi files. If I execute perl -cw something.cgi, It gives message as Syntax OK. If I execute perl something.cgi over command prompt, the scipt gets executed. Now problem is some of these scripts when called thr' browser gets executed, but others wont. Those scripts which cannot be executed successfully over browser, gives error message as, "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request." And the funniest part is, those which called thr' browser, gives error, can execute over command prompt successfully. Also there is no Qn of wrong URL. Because some of other CGIs execute properly, which are in the same directory, as these are. I can show you this script for a CGI, which cannot be executed over browser, #!/usr/bin/perl print "Content-type:text/html\n\n"; print "Test Page"; print "Hello World"; print "\n"; But the same code with different .cgi filename, in the same directory executes. Both are having same access rights. As well setting in access.conf is, # /home/httpd/cgi-bin should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # Options ExecCGI -> +ExecCGI *** BY VIKRAM -> This setting I found from one site # Added AddHandler cgi-script .cgi *** BY VIKRAM -> This setting I found from one site AllowOverride None Options +ExecCGI AddHandler cgi-script .cgi Also there is one more setting in srm.conf, is # To use CGI scripts: # Uncommented the following line AddHandler cgi-script .cgi Do I need anything other than this ? waiting for your reply, from, vikram. _ Chat with your friends as soon as they come online. Get Rediff Bol at http://bol.rediff.com
Re: Prob with configuring CGI.
Vikram Hari Deshmukh wrote: > > Well I have started with CGI, 2 days back. But some aspects makes me confused. > I am having Apache server over Redhat linux 6.2. I'm a bit confused too... You mention CGI but you posted to a mod_perl list. Are you using mod_perl? To run plain old CGI programs (using an external perl interpreter), all you need is: Allow from all Options +ExecCGI ScriptAlias /cgi /home/httpd/cgi-bin call it with http://my_domain/cgi/my_prog To run CGIs under mod_perl (using the mod_perl interpreter), with one-shot persistence (i.e. script executes then exits) use Apache::PerlRun; Allow from all Alias /perl-run/ /home/httpd/perl-run/ SetHandler perl-script PerlHandler Apache::PerlRun Options +ExecCGI call it with http://my_domain/perl-run/my_prog To run CGIs under mod_perl but with persistence (i.e. the interpreter stays loaded and global variables remain set) use Apache::Registry; Allow from all Alias /perl/ /home/httpd/perl/ SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI call it with http://my_domain/perl/my_prog You can also write your own handlers in mod_perl but that's quite a way from CGI - I don't think that's what you're trying to do... Rgds, Owen Boyle.