Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to change .cgi extension to .foo 1

Status
Not open for further replies.

shantec

Technical User
Oct 20, 2002
29
TR
i would like to change the cgi extension on perl my scripts.

i have done it before in php from the apache config file, from .php to .acp


i want the server to execute a script with a .foo extension as .cgi.

AddHandler cgi-script .cgi it works

i have changed it and written
AddHandler cgi-script .cgi .ads
it doesn't work

apache doesn't interpret the .ads extension as cgi

any feedback would be well appreciated


how can i do it in perl?

thank you.
 
AddHandler cgi-script .foo
is absolutely fine but to make sure the above works set:
Options All
in the Directory directive within the VirtualHost directive..

something like
<Directory &quot;/home/foo/bar&quot;>
Options All
</Directory>

hopefully it will work then ---
cheers!
san
pipe.gif


&quot;The universe has been expanding, and Perl's kind of been expanding along with the universe&quot; - Larry Wall
 
san,

thank you for your reply,
i will try your directive today,
---------------------
at the moment- i get this eror log



No such file or directory: exec of
/hello.ads failed
Premature end of script headers:
in this directory hello.cgi works fine though
------------------

thanks again
shann
 
San,

i get the same eror again,

internal server error

No such file or directory: exec of
/hello.ads failed
Premature end of script headers:
in this directory hello.cgi works fine though,
the directory understands . ads is executable,
but don't work


thank you very much
shann
 
hmm, that is very strange.. I've tried it before and it worked for me (i was using mod_perl though)

Ok, try setting this too:

AllowOverride All

inside the <directory> tag.

then in the .htaccess use this:

Code:
AddType text/html .ads

OR

Code:
ForceType text/html
---
cheers!
san
pipe.gif


&quot;The universe has been expanding, and Perl's kind of been expanding along with the universe&quot; - Larry Wall
 
san thank you for your help,

it was such a stupid mistake i made

since, i transferred the file with ftp and with the .ads extension- the script was not loaded , in binary mode and gave the error,
when i renamed the file ..cgi to ..ads,on te server it worked fine.

----------------------------
let me ask you one more thing
we have installed mod pearl on my server,but for a year we went on with the thought that, we had a mod perarl installed site,since it was showing in our server records on traceroute.

But our application was still eating huge amount of memory.
now i see, that, do i also have it configured for that special directory, in order to mod pearl kick in?
--------------------
if thats the case, that we have been fooled for ayear.

thanks a lot
shann

 
yep, just installing mod_perl or running your scripts on a mod_perl enabled server won't help you just like that :)

You need to use the SetHandler and then set the perlhander to Apache::Registry OR Apache::perlRun in httpd.conf.
I generally write my own handlers from scratch (as a personal choice though) since that makes them even more faaaster! Anyway, though both Apache::Registry and Apache::perlRun can run the scripts unaltered in most cases, but it may be sometimes that you may have to tweak up your scripts in some cases (to stop them from malfunctioning in mod_perl). ---
cheers!
san
pipe.gif


&quot;The universe has been expanding, and Perl's kind of been expanding along with the universe&quot; - Larry Wall
 
thank you San,

i will give mod_perl a try.
is mod_perl outdated or is it stil widely used?

instead of the mod_perl option, we have a perl daemon running on the server, to speed up the response process.

is there a link, that i can check, to optimize the perl code, for a lighter server load?

i'm sure i will bug you again- thanks

 
no its certainly not outdated :) never will it ever be.. &quot;a perl daemon&quot;? are you're referring to FastCGI? If so, then the case is totally different from mod_per ( also that too won't run all by itself )

Anyway, here are the links to both the official pages for above (do check them out):

mod_perl: FCGI:
I don't have any links for articles on optimizations, but I guess you can just google it or search the perl mailing lists. On a side note, I hope whatever your script may be, it is running on mySQL.. just a shot in the dark though; as most of the power hungry scripts that I've seen till date are non-mySQL scripts that are trying to do everything using perl code and flat files. Most of the time, these problems are remedified by adding a (indexed) mySQL database and rewriting the code to use it (thats the only optimization tip that I have :) ---
cheers!
san
pipe.gif


&quot;The universe has been expanding, and Perl's kind of been expanding along with the universe&quot; - Larry Wall
 
thanks san,

yes we do use the mysql with perl, and as you say, we had indexed it, to optimize speed. we have run some tests with the super smack load tester program, and we have found that indexing helped a lottt.

The deamon we use at the momemt ,is a perl code that works as a live process on the server,waiting for a cgi request.
yes i have checked the mod pearl,, boy it seems hard to configure.

thank you very much indeed

shann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top