ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
but the output is always my script registration.cgi:
Okay, do you mean that the server returns the text of your CGI script, and not the output from the running script? If so, then the solution should be easier to track down.
In Debian (and therefore Ubuntu, as I understand it), the Apache2 configuration is divided into individual virtual hosts, and each of these is in the /etc/apache2/sites-available/ directory. In that directory, the default site is defined in default. That is where you should find the CGI configuration elements that you could not find.
You may be able to restart the server with (as root)
I deleted /var/www/cgi-bin directory to use only /usr/lib/cgi-bin directory.
I double clicked on /var/www/registration.html, compile the form and the web page is firefox with:
Quote:
File not found
Firefox doesn't find /cgi-bin/registration.cgi file.
I cannot tell what is the problem, as nothing gets logged from apache. What happens if you go directly to: http://www.domain.com/cgi-bin/registration.cgi
BTW I have tested your script here and it works as expected.
Are you using Firefox as a filesytem browser? That makes the behavior subtly different, as it is not communicating with a web server. It sounds like you are using a Firefox browser on the same host as the the Apache web server, but merely using Firefox as a filesystem browser. Instead, try entering an HTTP URL to attach to the web server:
Code:
http://localhost/registration.html
This will force the referenced file to be fetched with an HTTP GET method, which causes the connection to the Apache server, where the Apache server invokes the CGI. All of this explains why you are seeing the text of the CGI script (apparently; you never did answer my earlier query about that), and not the result of the running script.
Observe the contents of the Apache access and error logs as you do this, and confirm that the URLs are being served by the server.
Ok, peraphs there are progress. Now my web browser message is instruction in my script:
Quote:
Software error:
Cannot open file: Permission denied at /usr/lib/cgi-bin/registration.cgi line 19.
For help, please send mail to the webmaster (webmaster@localhost), giving this error message and the time and date of the error.
Entry in /var/log/apache2 is:
Quote:
[Mon Jan 04 20:13:35 2010] [error] [client ::1] [Mon Jan 4 20:13:35 2010] registration.cgi: Cannot open file: Permission denied at /usr/lib/cgi-bin/registration.cgi line 19., referer: http://localhost/registration.html
Line 19 in /usr/lib/cgi-bin/registration.cgi is:
Quote:
open OUTPUT, ">> archivio" or die "Cannot open file: $!";
Okay, now it sounds like the server is invoking the CGI, but the CGI is trying to write where it (correctly) has no permission to do so. Use a file in the /tmp directory tree, or somewhere that has write permission.
Code:
open OUTPUT, ">> /tmp/archivio" or die "Non posso aprire il file: $!";
What is showing up in the Apache error and access logs about this?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.