GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Feb-2004, 12:57
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road

Running perl/cgi scripts on Apache server


I am trying to run a cgi/perl script from a specific folder on an Apache server (from the 'cgi-bin' subdirectory in my main user directory: the script alias is already specified in the httpd.conf file) BUT I keep getting a "The page cannot be found" error. I am trying to run the script from an HTML form inside a subdirectory: I use a form with "<FORM ACTION="../cgi-bin/testmike.pl" METHOD="GET">", so it should go up one dir to the main dir, then go into the 'cgi-bin' dir to run the 'testmike.pl' file. BUT I keep getting the not found error. I've set the correct permissions on the directory and file but it still doesn't find it. IF I change the dir name to 'cgibin' and point there, then it finds the file, but doesn't run it, only displays it. It's as if the alias is making it think the dir is actually somewhere else. what should I put in the ACTION parameter for it to actually find the script?

thx,
  #2  
Old 04-Feb-2004, 14:59
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi Mikenowo (or is it just Mike?).

Welcome to the forums. Here are mabye some things to check for.

I found it easier not to give any type of path when running cgi, as apache is configured to look for you cgi scripts by default under the cgi-bin directory.
I usually make a call in this manner:
HTML Code:
<FORM METHOD=POST ACTION="web_login">

BTW: that is a compiled c program, so there is no need in my case for .pl

Now, about permissions. Just make sure that your permissions are set properly. By default apache runs as a guest, so your permissions have to allow access by everyone. (This assumes a *nix install)

I would set my cgi-bin directory ownership to root, but access and reabable to everyone:
Code:
chown root:root cgi-bin chmod 755 cgi-bin

Now, your script has to be at least executable and readable by everyone as well, so in my case, I would set:
Code:
chmod 755 web_login

If this still doesn't work, please post back. There are other people that are way more experienced with this than I that should be able to help...
Last edited by Allowee : 05-Feb-2004 at 08:40.
  #3  
Old 05-Feb-2004, 08:29
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
404 Not Found errors are logged in your error log.

you can check your error log to see the full paths to the file.
and then you might be able to find and fix the problem
__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
  #4  
Old 05-Feb-2004, 11:22
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road
Quote:
Originally Posted by dsmith
Hi Mikenowo (or is it just Mike?).

Welcome to the forums. Here are maybe some things to check for.

I found it easier not to give any type of path when running cgi, as apache is configured to look for you cgi scripts by default under the cgi-bin directory.
I usually make a call in this manner:
HTML Code:
<FORM METHOD=POST ACTION="web_login">

BTW: that is a compiled c program, so there is no need in my case for .pl

Now, about permissions. Just make sure that your permissions are set properly. By default apache runs as a guest, so your permissions have to allow access by everyone. (This assumes a *nix install)

I would set my cgi-bin directory ownership to root, but access and readable to everyone:
Code:
chown root:root cgi-bin chmod 755 cgi-bin

Now, your script has to be at least executable and readable by everyone as well, so in my case, I would set:
Code:
chmod 755 web_login

If this still doesn't work, please post back. There are other people that are way more experienced with this than I that should be able to help...

Thanks for the welcome , name's Mike (nowo are first 4 letters of last name).

Ok, the problem here is, it is not my site, it's a providers' (therefore I don't have access to system files etc). What I'm trying to do is let them know what to set through an email conversation which is tedious at best.

In any event, what I want is to be able to run the script from within my OWN cgi-bin directory (not the main default one that Apache usually has, this because I don't have access to that default dir). The ISP has informed me that they do have an entry in the httpd.conf file that also points the script path to a cgi-bin directory within MY main dir, but I can't seem to get my form to recognize where it is. I tried using just the script name without specifying the cgi-bin dir in the form line "<FORM METHOD=POST ACTION="script_name">" as you suggested, but it still doesn't find it. As for my permissions, I have both the directory and the script set to 755, so that shouldn't be the problem...

... <dancing banana interlude > ...

Ok, we're back...

I've set up my own apache server before and have gotten this to work, just been a while so it's not fresh in my mind. I'm pretty sure the alias they set in the conf file is adding some sort of prefix to the directory path, it's just a matter of getting it right for my form statement. Never easy to solve a problem when you don't have access to the resources <g>.

Thx for the suggestion, I'll just have to plug along until I solve this.
  #5  
Old 05-Feb-2004, 12:52
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Mike,
Sorry, I couldn't be of more help. It definitely sounds like your problem is with your provider. All of my exp. has to do with on-site servers. If you do find anything groundbreaking, please post back and let others know.

Thanks.
  #6  
Old 05-Feb-2004, 22:01
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road
Quote:
Originally Posted by Allowee
404 Not Found errors are logged in your error log.

you can check your error log to see the full paths to the file.
and then you might be able to find and fix the problem

I've attempted the same thing on my own apache server and get the same error, BUT I don't see any entry in the "/var/log/httpd/error_log" error log? Is there another log file you are talking about?
  #7  
Old 06-Feb-2004, 04:30
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
it could be that the error log is located somewhere else.

you will have to take a look at httpd.conf and search for 'ErrorLog' and 'LogLevel':
`egrep -i '(ErrorLog)|(LogLevel)' /your/path/httpd.conf`

if LogLevel is 'warn' it should log 404 errors
__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
  #8  
Old 06-Feb-2004, 11:42
mikenowo mikenowo is offline
New Member
 
Join Date: Feb 2004
Posts: 13
mikenowo is on a distinguished road
Quote:
Originally Posted by Allowee
it could be that the error log is located somewhere else.

you will have to take a look at httpd.conf and search for 'ErrorLog' and 'LogLevel':
`egrep -i '(ErrorLog)|(LogLevel)' /your/path/httpd.conf`

if LogLevel is 'warn' it should log 404 errors

Well, I checked the httpd.conf file and the error log file is in the default dir "etc/httpd/conf/" and the LogLevel *is* 'warn', BUT when I try to submit the program and get the '404' error, nothing gets logged to that file


Here is the error page I get:
***
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
------
Please try the following:
If you typed the page address in the Address bar, make sure that it is spelled correctly.
Open the 65.94.96.220 home page, and then look for links to the information you want.
Click the Back button to try another link.
Click Search to look for information on the Internet.
HTTP 404 - File not found
Internet Explorer
***
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache php no longer working (MX??) XP?? ChicoMendez Apache Web Server Forum 5 30-Aug-2004 11:51
· Windows 2003 Server Reseller Special: Unlimited Domains/2 GB Space/for $19.99 contactsonia Web Hosting Advertisements & Offers 0 09-Jan-2004 06:46
Help making Apache to WAP server ! Lazmo Apache Web Server Forum 1 02-Jan-2004 13:27

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:08.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.