How can I activate perl? (in Off-topic)
April 11 2006 3:53 PM EDT
I have a perl script in my web server's cgi-bin directory but i can't get it working.
I know it works when I have access to the file but don't know how to set the right permissions apparently... >.<
anyone able to help me?
April 11 2006 4:26 PM EDT
Does the webserver have read and execute permissions for the script?
Does the script start with the correct bang path (#!) to the perl binary?
Is what you call the cgi-bin directory actually a cgi-bin directory?
April 11 2006 4:38 PM EDT
Here is a bit from my service provider, explaining how to have scripts work:
CGI scripts must be set as executable files through correct use of the permissions of the file. You need to change the permissions, or the "mode" of your programs in your FTP program to either "755" or "rwxr-xr-x". If a script tells you that it must be 775 or 777, do not listen! If your CGI scripts have this level this will allow anyone on the server to write to this script and possibly delete your files!
My service provider has Perl in /usr/bin/perl. If yours works on your machine, maybe you have it set to /usr/local/bin/perl?
April 11 2006 4:53 PM EDT
If unsure where perl actually is, the following bangpath (or shebang) can be used:
There's a small risk that this will find the wrong perl.
The spellchecker probably hates other languages, as perl is not in its dictionary. TCL is ;)
or email me when you are online and I'll hit you up in chat and walk you
April 11 2006 7:55 PM EDT
Bart, what if their env is in the wrong spot? *smile* Or is that standard beyond the realms of possibility?
April 12 2006 11:34 AM EDT
well the perl script was written by stump.
and the bang path you ask for is: #!/usr/bin/perl
so perhaps this should be modified to include local...
April 12 2006 11:36 AM EDT
this is the current error i received:
You don't have permission to access /optimize.pl on this server.
Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.
Apache/1.3.34 Server at www.cbstuff.nl Port 80
April 12 2006 11:43 AM EDT
/ sounds not like cgi-bin directory. Apart from that, the error indicates that the webserver has no read permissions to the file. Make sure it has read and execute permissions to that file (755 a.k.a. rwxr-xr-x).
April 12 2006 11:44 AM EDT
If env is not there, the system is not Unix, or its administrator should be fired ;)
April 12 2006 11:45 AM EDT
changing it to #!/usr/bin/env perl doesn't help either alas.
however there is another file in the cgi-bin directory called .htaccess
In this the following line is typed:
In another directory i find another perl script document and another .htaccess file containing these lines:
AddHandler cgi-script pl
April 12 2006 11:48 AM EDT
Make sure it has read and execute permissions to that file (755 a.k.a. rwxr-xr-x).
I have set the permissions to 755 already (was default)
April 12 2006 11:55 AM EDT
Never mind, I had the wrong directory in my browser, it works. :D
This thread is closed to new posts.
However, you are welcome to reference it
from a new thread; link this with the html
<a href="/bboard/q-and-a-fetch-msg.tcl?msg_id=001m6N">How can I activate perl?</a>