Perl does not work

emielvenlo

Verified User
Joined
Oct 21, 2008
Messages
11
I dont get Perl to work on websites, alltough it does work in the shell.

I have made a testfile to check this:
Code:
[root@vps tube]# cat test.pl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "I'm running :)";
[root@vps tube]# ./test.pl
Content-type: text/html

I'm running :)[root@vps tube]#
As you see the perl file executes the right way in the shell.

The same testfile on the website gives: http://www.sexable.nl/tube/test.pl

Does anyone know what could be wrong?
 
I get this to, this is the problem.

The file is really there and has the good permissions.
 
Also typically .pl is used when running form the command line and .cgi is used when using a web browser.
 
I can really assure you that the file is there and has 777 permission.
Code:
[root@vps tube]# pwd
/home/admin/domains/sexable.nl/public_html/tube

Also typically .pl is used when running form the command line and .cgi is used when using a web browser.

That may be, but i have to install the phpmotion script, and this script has .pl for their perl files.
 
I can really assure you that the file is there and has 777 permission.
Code:
[root@vps tube]# pwd
/home/admin/domains/sexable.nl/public_html/tube

You did not show the "ls -l"

However your statement "has 777 permission" shows you the problem. Permissions are incorrect and are extremely insecure and thus it will not run.

has the good permissions

In fact it has very bad permissions.
 
-rwxr-xr-x 1 root root 77 mrt 27 20:45 test.pl

That is not 777. It sounds like you have a lot more to learn than I have time to teach.

Also if the script is going to be run by admin it needs to be owned by admin.
 
My mistake, i did set it on 755, as the install manual of php motion suggested for pl files.

I have now set the owner and group to admin, like all other files. Is the following permissions setting ok?
-rwxr-xr-x 1 admin admin 77 mrt 27 20:45 test.pl
 
When i see this log:
Code:
cat /var/log/httpd/domains/sexable.nl.error.log
I see this:
Code:
[Sun Mar 28 14:11:20 2010] [error] [client 82.174.242.251] Options ExecCGI is off in this directory: /home/admin/domains/sexable.nl/public_html/tube/test.pl

I dont know where to set the ExecCGI option, is this in httpd.conf?

I think this is the part that is relevant from the httpd.conf:
<Directory "/var/www/cgi-bin">
AllowOverride none
Options None
Order allow,deny
Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-gzip .tgz
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddType video/x-ms-asf .avi
AddType video/mpeg .mpg
AddType video/mpeg .mpeg
AddType video/quicktime .mov
AddType video/x-ms-wmv .wmv
</IfModule>

Do you see any faults?
 
Last edited:
I am sorry to ask, but don't you know the answer or you want to teach me a lesson?

Some background info: I am busy installing phpmotion from friday evening till now (with pauses to do some other duty's)
I have had poroblems installing:
  • PHPShield
  • FFmpeg
  • PHPShield (again because the ffmpeg installation changed something in the extensions directory)
  • Subdirectory (script is aimed at root of the website, wich in my case is not the place where the script is)
These where the things i managed on my own till Saturday evening, without asking on any forum but with googling and looking in to knowledge bases from directadmin and phpmotion. After being busy from saterday evening till now to get perl to work this topic is the first question i ask, so i think it is not in place to make these kind of sarcastic comments:
Its there for a reason.
 
I am not going to fight with you. However if you do not bother to do the research yourself then you can expect some degree of sarcasm from people.

looking in to knowledge bases from directadmin

You have not searched the knowledgebase for ExecCgi or else you would have found the answer.

you want to teach me a lesson?

No. Quite the opposite. As I stated before I do not have time to teach you everything about server administration. Nor do I know everything from memory. Nor am I going to search using google or the knowledgebase or the forum and pretend to hold your hand and show you every little thing.

I will however do my best to tell you where to look for the answer.

Your last problem was

Options ExecCGI is off

I know for a fact that the answer to that problem is in the knowledgebase. I have used it myself. No I do not remember the exact link. No I do not remember the exact answer. But I tried to tell you where to find the answer.

Now you accuse me of being sarcastic when in fact I have done nothing but try to help you. I am sorry I could not hold your hand and give you the exact answers you needed. I cannot remember everything nor can you or anybody else.

But since that is what you want and I cannot give you that then I will stop here. I hope you find what you are looking for.
 
I think you are refering to this one, i came across it several times since last night:

http://help.directadmin.com/item.php?id=7

This was giving some errors.

Now i have resolved it: http://www.sexable.nl/tube/test/test.pl

I have used this .htaccess solution, wich did not work in the first place because there where several permissions issues.

The solution was:
chown admin directory/
chgrp admin directory/
cd directory/
chgrp admin *
chown admin *
chmod 755 *
And then placing the following in the .htaccess:
Options +ExecCGI
AddHandler cgi-script .cgi .pl
 
By default cgi scripts, whether .cgi or .pl, run from your cgi-bin directory.

So moving the file there, and executing it from there, would be the way to make it work.

Then you wouldn't need any changes anywhere.

Jeff
 
By default cgi scripts, whether .cgi or .pl, run from your cgi-bin directory.

So moving the file there, and executing it from there, would be the way to make it work.

Then you wouldn't need any changes anywhere.

Jeff

He needs to stop writing scripts as root and trying to execute them as root.
 
Back
Top