Perl support does not work with apache after its installed/configured
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Perl support does not work with apache after its installed/configured
Hi
I have a debian 5.0 box with apache2 installed (i used "aptitude install apache2" to install apache2). After i installed apache i also installed libapache-mod-perl2 (i used "aptitude install libapache2-mod-perl2) since im going to be using apache to run perl scripts.
The LoadModule directive was added in the apache configuration as well as the "AddHandler cgi-script cgi pl". The cgi-bin/ directory is already configured with "ExecCGI" and ScriptAlias is set to "ScriptAlias /cgi-bin/ /var/www/cgi-bin".
It only shows me a download dialog which i wierd since i have added the mod_perl apache module to apache. I have looked at the error log for apache and it says nothing at all.
The /var/www/cgi-bin directory is owned and readable by the user that is running apache and the perl scripts being run is executable.
I just dont know what more to do here and i would appericiate it if someone could help me out here.
I stopped and started apache now, no change. I dont understand why i would need to restart apache just because a new script was added, i know its not necessary to do this..but, that said it didnt change anything.
OK, I was just thinking that since you are using mod_perl it might be caching the script (forgetting that it would reload it if the file was modified). Anyway, it's been a while since I've done perl web stuff. Anyway, I think I was on the right track initially. But, like I said, it's been a while. You actually need two \n's at the end of your Content-type line, not just one. So, try that and let me know.
There were no changes, the download dialog still appeared.
Under the /var/cache/apache2 directory i can see that there is a directory called "mod_disk_cache", but this directory is empty.
I also cleared firefox' cache before i restarted apache and tried to run the script again. I dont know how i would clear mod_perl' cache.
The space may also be causing a problem. However, it doesn't appear that your server is even trying to run the command. It looks like you are trying to serve it up as a file. You may need to revisit your config.
I tried to run it without the space now, but it didnt change anything. You seem to be correct when you say that apache doesnt even seem to be running the file as a script. The following is shown in the access log when i try to run the file:
127.0.0.1 - - [02/May/2009:01:43:21 +0200] "GET /cgi-bin/test2.pl HTTP/1.1" 200 72 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1)"
I have checked the apache configuration again, but i cant see anything thats missing. It is only the "LoadModule", "AddHandler" that is needed isnt it ? I have the ExecCGI as well but i dont know if this is actually needed when using mod_perl. I have read some articles on the net and searched google, but they only seem to describe what i have done.
I also searched for the mod_perl caching problems and it looked like mod_perl only compiled the code one time, but im not sure about this, and if this is the case, then how would it be cleared or what would be needed to do to re-compile the file again.
Here are the lines from my httpd.conf that I had to modify to get cgi-bin to execute scripts:
556 # ScriptAlias: This controls which directories contain server scripts.
557 # ScriptAliases are essentially the same as Aliases, except that
558 # documents in the realname directory are treated as applications and
559 # run by the server when requested rather than as documents sent to the client.
560 # The same rules about trailing "/" apply to ScriptAlias directives as to
561 # Alias.
562 #
563 ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
564
565 #
566 # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
567 # CGI directory exists, if you have that configured.
568 #
569 <Directory "/var/www/cgi-bin">
570 AllowOverride None
571 Options ExecCGI
572 Order allow,deny
573 Allow from all
574 </Directory>
Thanks for answering forrestt. I already have this configuration present in apache, thats what makes it so wierd that it doesnt work. I cant imagine what it can be. Ill continue to search the net, and read in my apache book to try to figure out whats actually happening here. Please do reply if you have any more ideas
I downloaded, compiled and installed Apache 2 and then added mod_perl2 through the CPAN shell. And after adding the "LoadModule" line to the apache config. the perl scripts worked. I dont have any logical explanation to why debian' specific apache configuration didnt work though.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.