logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Perl script : HTTP 403 Forbidden
Author
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Tue 23 Dec '14 12:42    Post subject: Perl script : HTTP 403 Forbidden Reply with quote

I am trying to run a simple Perl CGI on Apache 2.4.10 on Windows 7 Professional.
My Perl directory is c:\perl64\bin\perl5.20.1.

c:/localhost/ gives me the Welcome page.

c:\perl64\bin\fig.pl works.

c:\Apache24\httpd.conf is changed to :

serverRoot "c:/Apache24
Alias /cgi-bin /c:/Apache24/cgi-bin
<Directory c:/Apache24/cgi-bin>
AddHandler cgi-script cgi pl
Options ExecCGI
</Directory>

Http://localhost/c:/Apache24/cgi-bin/fig.pl
gives Http 403 Forbidden
The Website declined to show this Webpage . Http 403.

Please let me know "How to add Perl CGI Support to
my Apache 2.4.10 Web Server on Windows 7.

How to run my Perl CGI.
How to avoid Http 403 .
Farideh
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 23 Dec '14 13:10    Post subject: Reply with quote

Since you you can Alias you need to call the script a bit different in your URL. Do not put the windows path into the url Wink

http://localhost/cgi-bin/fig.pl

if you still have a question please ask again.
Back to top
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Tue 23 Dec '14 14:57    Post subject: Reply with quote

thanks, but by typing :
http://localhost/cgi-bin/fig.pl
I have : Http 403.
Farideh


Last edited by farideh on Tue 23 Dec '14 17:10; edited 1 time in total
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 23 Dec '14 15:19    Post subject: Reply with quote

Are you sure your script is in c:/Apache24/cgi-bin ?
Back to top
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Tue 23 Dec '14 17:20    Post subject: Reply with quote

Yes I am sure .

c:\Apache24\cgi-bin\fig.pl

is where my CGI Perl Script Is.

To Run it I type:
http://localhost/cgi-bin/fig.pl or

http://localhost/c:/Apache24/cgi-bin/fig.pl/
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 23 Dec '14 23:57    Post subject: Reply with quote

Sorry,

I missed an important part...

You directory needs a
Code:

Require all granted


http://localhost/cgi-bin/fig.pl will work!
Back to top
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Wed 24 Dec '14 13:43    Post subject: Reply with quote

Hi James :
I added "Require all granted"

Http://localhost/cgi-bin/fig.pl
gave me HTTP 404 Not Found.

By examining "c:/Apache24/logs/error" the followings found:

[Wed Dec 24 12:54:28 . 0365 39 2014] [core : error]
[pid 2884 : tid 940] (20023) the given path was above
the root path : [client :: 1 : 2424]AH00127: can not map GET /c:/Apache24/cgi-bin/fig.pl HTTP/1.1 to file.

I have also read about chmod 755 command on Unix to resolve Directories problems. But on Windows, have not seen any.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 26 Dec '14 18:38    Post subject: Reply with quote

On Windows there is no need for chmod.

You may try ScriptAlias http://httpd.apache.org/docs/2.2/mod/mod_alias.html#scriptalias which is easier to set up.
Back to top
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Sun 28 Dec '14 20:39    Post subject: Reply with quote

It worked. Thanks for trying to help.
solution :
<Directory />
Options FollowsymLinks
AllowOverride none
Require all granted
</Directory>

ScriptAlias /cgi-bin "c:/Apache24/cgi-bin/"
<Directory c:/Apache24/cgi-bin>
AddHandler cgi-script cgi pl

options ExecCGI
</Directoriy>
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Mon 29 Dec '14 13:24    Post subject: Reply with quote

There is a tutorial at http://www.tommyrodriguez.com/?p=446 , special attention to step 3.

Also try to have the first line of your script point to Perl.exe, in your case:

#!c:\perl64\bin\perl5.20.1\bin\PERL.EXE

Btw.
In your first post above you say that the Perl location is : c:\perl64\bin\perl5.20.1. Little strange naming for me.

So be sure where your perl.exe is.
Back to top
farideh



Joined: 21 Dec 2014
Posts: 6

PostPosted: Mon 29 Dec '14 20:34    Post subject: Reply with quote

Hi Steffen
Thanks for the tutorial.
The Strawberry Perl has this strange Directory.
Back to top


Reply to topic   Topic: Perl script : HTTP 403 Forbidden View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner