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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call mod_perl scripts from browser

Status
Not open for further replies.

MatthewP

Programmer
Jan 16, 2001
176
GB
Hi,

I've just got a linux server with mod_perl pre-installed and set up. I've been told to put my scripts in /home/httpd/perl (I had to create the perl directory), but how can I get to this from a browser? If I go to mysite.com/perl I get directory cannot be found - do I have to do something else in the .conf file or something? I'm told it's set up and ready to go but I can't work it out...

Thanks,
Matt.
 
If these are your average everyday perl scripts, you should be able to open a terminal and execute them from the shell. If you need to access them via a web browser, then they are cgi scripts written in perl. Since most cgi scripts are executed on the server side, you may have to fire up a web server. Most linux distros come with apache already installed. In most cases you would put the scripts in the cgi-bin.
 
Well, when you set up mod_perl you add an extra part in your httpd.conf;

ie. Anything excecuted in cgi-bin/ is executed by perl
Anything excecuted in cgi-mod/ is executed by mod_perl

This all depends in what you set in the httpd.conf. Read the apache (or your webserver) guide for more information.

You could also configure it just to load everything under mod_perl; it's all about how you configure it.


wzrd
 
Well, in the /home/httpd directory I've got cgi-bin, html and perl directories. If I go to the browser and go to mysite.com/cgi-bin/script.pl it will execute the script, but if I go to mysite.com.perl/script.pl I get directory doesn't exist. This is I think something to do with sim links whatever they are - Im a bit new to all this - and the hosting company are no help whatsoever!

Thanks,
Matt.
 
Hi,

mod_perl is a drop-in accelerator for perl scripts and the config is all on the server. Perl scripts in cgi-bin should work asis but to use the /home/html/perl directory the httpd.conf would need to have a alias. Normally this would be :

Alias /perl/ /home/httpd/perl/

there would also be a Location container like :

<Location /perl>
Options +ExecCGI
SetHandler Perl-Script
PerlHandler Apache::Registry
PerlSendheader On
</Location>

If you place a .pl script in /home/httpd/perl and it doesn't work as then I'd go back to your ISP .

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top