This is my second request for help with this problem. I have followed the suggestions given the first time and made some progress but I still have one final problem/question.
I have two CGI scripts that don't work. One is the standard Set-Cookie, examples can be found all over the net, that sets a cookie and prints "Your cookie name is set." The other is an automatic installation script that comes from commerce-cgi.com and is for installing their CGI shopping cart.
Both of these scripts are now located in /var/www/cgi-bin/ and the folder and the scripts are set to apache:apache 755. BTW a setting of root:root also fails exactly the same way.
If I run either of these scripts from a browser using www.domain.com it fails. If I run it from a browser using www.domain.com/cgi-bin/install.cgi or www.domain.com/cgi-bin/techtest.cgi it works.
I have tried using a one line index.shtml file with that one line being either <!--#include virtual="/cgi-bin/install.cgi"--> or <!--#exec cgi="/cgi-bin/install.cgi"--> and they both fail.
They do find and execute the script. The set cookie script prints the "Your cookie name is set." message OK but the cookie is not sent to the browser. The install script loads the first HTML page ok but does not load the second page.
I had a friend-of-a-friend IT guy that I trust look at everything. He hasn't found anything obvious. If he tries to run either of these scripts from his computer, it works OK.
Can someone here help me understand why this is happening?
Mel
PS posts in other online places (as suggested here) did not get any replies.
tech wrote:
If I run either of these scripts from a browser using www.domain.com it fails. If I run it from a browser using www.domain.com/cgi-bin/install.cgi or www.domain.com/cgi-bin/techtest.cgi it works.
Yes. Look at ScriptAlias in the config. And at the SELinux contexts in that directory.
I have tried using a one line index.shtml file with that one line being either <!--#include virtual="/cgi-bin/install.cgi"--> or <!--#exec cgi="/cgi-bin/install.cgi"--> and they both fail.
Yikes!
Calling www.domain.com/cgi-bin/install.cgi is the correct way, using SSI together with cgi scripts calls for trouble.
And next time you ask something please include *error* messages.
Ralph
Ralph Angenendt wrote: And next time you ask something please include *error* messages.
Ralph,
Sorry. I should have said that there is nothing in the error log. I have entries in the access log but not the error log. I had one before but I did a complete format and re-install and it is gone.
Let me also say that SELinux is OFF.
ScriptAlias is set and I believe it is correct.
I have gone over httpd.conf carefully and had someone else look at it. The obvious things seem to be OK.
I did go back and verify one thing, when the IT guy was testing and it worked for him, he was using www.domain.com/cgi-bin/install.cgi and not just www.domain.com. That also failed for him.
Tech wrote on Fri, 17 Oct 2008 22:34:02 +0800:
I did go back and verify one thing, when the IT guy was testing and it worked for him, he was using www.domain.com/cgi-bin/install.cgi and not just www.domain.com. That also failed for him.
Of course, it does. If you have a URL http://www.example.com/path/file.htm and you want to have this file served when someone goes to http://www.example.com/ you have to do something to make this happen. There is no magic that will read your mind and then do that for you. So, if I interpreted your problem correctly you want to go to the newsgroup comp.infosystems.servers.www.unix and ask there the following:
I have a script http://www.domain.com/cgi-bin/install.cgi that works fine. Now I would like to have it called when someone accesses http://www.domain.com/. How can I achieve this with my apache version x.y.z. on CentOS z.y.x?
That's just four lines, no lame excuses, no lengthy description of non- related stuff. And in the right place. *This* list is *not* the right place.
Kai
--- On Fri, 10/17/08, tech tech@laamail.com wrote:
From: tech tech@laamail.com Subject: [CentOS] CGI configuration - second post To: centos@centos.org Date: Friday, October 17, 2008, 1:12 AM This is my second request for help with this problem. I have followed the suggestions given the first time and made some progress but I still have one final problem/question.
I have two CGI scripts that don't work.
Mel,
This is a feature, not a bug. Take a look at how httpd configures for cgi:
#grep cgi /etc/httpd/conf/httpd.conf
notice that a handler is set for /var/www/cgi-bin