Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
I'm trying to set up my apache2 server to run CGI scripts.
I have the script in the default directory with the default options, but when I run the script, my browser (firefox and IE) do not run the file. Instead, they offer to download it.
Links2 gives your the option to "Save" or "Display". When you display, it executes the script fine.
Can anyone explain why the computer wants to download instead of just running it like a normal webpage?
my options in apache config file are:
Code:
ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
###
### This is intended for your world-accessible CGI programs.
###
<Directory /var/www/localhost/cgi-bin>
AllowOverride All
Options ExecCGI
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
Your web server obviously isn't configured correctly. The catch is finding out where the problem actually is. I'm familiar with apache, but I'm no expert...
I'm not sure if this matters, but your directory line doesn't have an end slash. If I recall correctly, apache will treat URLs that don't end in slashes as files, and those with slashes as folders.
Try adding a forward slash to your directory line and restart apache.
I now have it working, I have the wrong "content type:" . it now works.
is it possible to run this cgi script from within a webpage? That is, just the html already generated and then have a bit that runs the cgi script and puts the output on page?
I have users on my server, and I want them to be able to see their quota and quota usage when they look at the site.
You mean embed CGI in HTML? There is a way to do it, but I haven't tried it, so I have no idea how well it works.
The package is called: perl-HTML-Embperl
The alternative is to use php, which is designed to be embedded in HTML by default. I am far more familiar with php than perl, but I can tell you php works very well, and is a well suited CGI language.
If you want to stick with perl (which is obviously very capable), I would check on that package I mentioned above, which will let you run any perl you want and embed the results in your HTML, just like you want. The actual perl code that you use is another story... there are quite a few sites on the web that allow you to download cgi scripts for free. You just have to search for them.
I tried doing a similar thing in perl, using the system() command, but i didn't like the "awk" lines for some reason. I thought it might have had a problem with the $3 bit, but I couldn't figure it out.
I have sorted out the way to generate user quotas just using a simple form where they put their username. I have the perl script to get and print the answer, but I can't generate the answer yet!
If anyone can tell me what I'm doing wrong with the perl to get the user quota, then that would really be a help.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.