Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-03-17 13:46:19

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 3,888

403 on a Perl script

I’ve a Perl script (contact form) implemented in a very old non-TXP website, that throws 403 forbidden each time I send. I set it temporarily to crazy 777 (also the surrounding directory), asked the support whether execution of Perl scripts is included in my package (it is!), looked at the .htaccess (1 redirect, for an .html file, nothing else contained), emptied the cache…

403 means it doesn’t even look inside the file, right?
Is there anything I might have forgotten to do?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#2 2017-03-19 10:38:52

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,038
Website

Re: 403 on a Perl script

uli wrote #304849:

403 means it doesn’t even look inside the file, right?

Yes, unless the script itself throws a 403, but I suspect you ruled that out.

Is there anything I might have forgotten to do?

Some things to test:

  • create a file with the same extension (.pl?), does it also throw a 403?
  • rename the perl file to have a .txt extension, does that load in your browser (as plain text obviously)?

Offline

#3 2017-03-19 13:42:08

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 3,888

Re: 403 on a Perl script

Thanks for your hints, Ruud, much appreciated!

Renamed to a .txt file and called via URL, it responds from inside the file with:

Error: GET request

The HTML form fails to specify the POST method, so it would not be correct for this script to take any action in response to your request.

If you are attempting to configure this form to run with MyContactFormScript1, you need to set the request method to POST in the opening form tag, like this: <form action="/cgi-bin/MyContactFormScript.pl" method="post">

I think this might also answer your annotation …

unless the script itself throws a 403

… right? (Sorry for the stupid question, I’m a bit thick when it comes to server tech.)

Another file with a .pl extension and 755 rights, containing the word “text”, no spaces, no other characters, throws a

500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Added: The same textfile, now suffixed with .txt, throws the same 500 error. I should mention that the surrounding folder is called cgi-bin and is immediately inside the root directory.
According to my logic the issue should be caused by the hoster’s configuration of my webspace, right? (Cheap webspace, no ini-file whatsoever.)

1 Renamed.

Last edited by uli (2017-03-19 13:44:29)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2017-03-19 19:05:22

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,038
Website

Re: 403 on a Perl script

If you want me to have a look, send me the URL and if possible the credentials to access the server.

Offline

#5 2017-03-19 20:36:55

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 3,888

Re: 403 on a Perl script

Thanks, Ruud, mail is sent.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2017-03-20 19:52:05

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,038
Website

Re: 403 on a Perl script

Problem was caused by the webhost blocking access to CGI files called FormMail.pl
This makes sense because the older versions of that script were very insecure (unlike the version Uli uses).
Solution: use a different filename ;)

Offline

#7 2017-03-21 13:27:45

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 3,888

Re: 403 on a Perl script

Thanks, Ruud, that really did the trick, yay!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB