Welcome to Dream.In.Code
Become an Expert!

Join 149,601 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,910 people online right now. Registration is fast and FREE... Join Now!




cgi scripts not working

 
Reply to this topicStart new topic

cgi scripts not working

nbarten
3 Oct, 2007 - 08:45 AM
Post #1

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 112



Thanked: 2 times
My Contributions
Hi,

Well, i hope this is the right categorie to ask my question because i write my cgi scripts in perl.

I'm new to cgi scripts, i want to learn very much... but i have a problem starting with. When i tried to run a .cgi script with my browser, it said something like '403 Forbidden'. I've tried many things, but i'm still stuck.

I'm using easyphp 1.8 with apache and mysql, i configured the apache configuration file (dhttp.conf or something like that) like a tutorial said, but I still get the message 'Forbidden'. I'm sure the cgi script is fine, it's a kind of begin script i copied from a tutorial.

So maybe you guys know what's wrong? Maybe it's only a simple thing, but i'm desperate to find the answer so i can continue my programming.

Or if you know a very good cgi tutorial (i've seen already many) or how to configure apache, please tell me.

Thanks in advance.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Cgi Scripts Not Working
3 Oct, 2007 - 08:56 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,134



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(nbarten @ 3 Oct, 2007 - 09:45 AM) *

I'm using easyphp 1.8 with apache and mysql, i configured the apache configuration file (dhttp.conf or something like that) like a tutorial said, but I still get the message 'Forbidden'. I'm sure the cgi script is fine, it's a kind of begin script i copied from a tutorial.

Thanks in advance.

Within your apache config (should be httpd.conf) there is an option for your cgi-bin directory. You'll also want to make sure that this directory & your cg-bin file has been given executable permissions. This can be found via ls -l on a *nix OS.

Are you trying to view the script locally or externally from the network?

Good luck!
User is online!Profile CardPM
+Quote Post

nbarten
RE: Cgi Scripts Not Working
3 Oct, 2007 - 09:03 AM
Post #3

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 112



Thanked: 2 times
My Contributions
QUOTE
This can be found via ls -l on a *nix OS.


What do you mean with this? I'm using Windows XP btw, not Linux or something like that (if you refer to that)

I tried it with 127.0.0.1... so locally i think. Does that make a difference?
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Cgi Scripts Not Working
3 Oct, 2007 - 09:08 AM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,134



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(nbarten @ 3 Oct, 2007 - 10:03 AM) *

QUOTE
This can be found via ls -l on a *nix OS.

What do you mean with this? I'm using Windows XP btw, not Linux or something like that (if you refer to that)

Linux, Unix, Aix...

QUOTE(nbarten @ 3 Oct, 2007 - 10:03 AM) *

I tried it with 127.0.0.1... so locally i think. Does that make a difference?

You're webserver is running on 127.0.0.1?

It would make a difference if it worked locally, but not externally.

Do you have something similar to the following in your httpd.conf?
CODE

      ScriptAlias /cgi-bin/ "/apache/cgi-bin/"

      <Directory "/apache/cgi-bin">
          AllowOverride None
          Options None
          Order allow,deny
          Allow from all
      </Directory>

      AddHandler cgi-script .cgi


You may need to specify where your cgi-bin directory is located, & where your apache is allowing executable permissions of those files.

User is online!Profile CardPM
+Quote Post

nbarten
RE: Cgi Scripts Not Working
3 Oct, 2007 - 09:25 AM
Post #5

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 112



Thanked: 2 times
My Contributions
Omg...

Forbidden
You don't have permission to access /mytime.cgi on this server.

still no succes. This is what i have in httpd.conf:

CODE

    ScriptAlias /cgi-bin/ "${path}/apache/cgi-bin/"

    #
    # "${path}/apache/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #
    <Directory "${path}/apache/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>

</IfModule>


And this somewhere else:

CODE

AddHandler cgi-script .cgi


I made a map in my apache folder named 'cgi-bin' and put the cgi file in there... but still no succes.

btw, you know where to edit that $path?
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Cgi Scripts Not Working
3 Oct, 2007 - 09:28 AM
Post #6

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,134



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(nbarten @ 3 Oct, 2007 - 10:25 AM) *

btw, you know where to edit that $path?

I wouldn't use variables, I would make the path absolute (type it all out)

User is online!Profile CardPM
+Quote Post

nbarten
RE: Cgi Scripts Not Working
3 Oct, 2007 - 09:42 AM
Post #7

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 112



Thanked: 2 times
My Contributions
Finally, it works! So happy... biggrin.gif

Thank you!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 11:45PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month