I had already installed Apache. I am using PHP for my scripting in localhost. Need to know how to run the perl script. I have installed sudo aptitude install libapache2-mod-perl2 I have created a directory name cgi-bin in my /var/www/cgi-bin there inside this folder i have kept my perl script perl_1.pl The directory permissions are given. What more i have to do to run the script???? i just type http://localhost/cgi-bin/ and i got error 403 You don't have permission to access /cgi-bin/ on this server. please help!!
Thanks
you can't read the cgi-bin contents. You must refer directly to one of the scripts in it, in this case: http://localhost/cgi-bin/perl_1.pl
Outside of that, ensure that your cgi-bin/ directory is actually treated as such in httpd.conf.
Oh, and in case you stumble on 500 afterwards: make sure that your perl script prints a valid HTTP header. This can easily be achieved by:
And as Pwex pointed out: make sure your script has the executable bit set.
...should work in most cases
Additionally, for future reference it is worth mentioning mod_perl, as it is a natural next step after getting the basics of cgi + perl + apache down. Going into detail about it would be beyond the scope of this answer, but I thought I'd mention it so that you know where to go next when you've got the basics nailed down as well as seen the limitations of cgi.