Run Perl scripts

Questions about hosting a Website, using MySQL, PhP or MariaDB may be posted here.
Forum rules
1) This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form:
https://myds.synology.com/support/suppo ... p?lang=enu
2) To avoid putting users' DiskStation at risk, please don't paste links to any patches provided by our Support team as we will systematically remove them. Our Support team will provide the correct patch for your DiskStation model.

Run Perl scripts

Postby Ero » Sat Nov 08, 2008 5:06 pm

Hi!
I have a DS207+ (firmware DSM 2.0-0722) and I was wondering if it's possible to run Perl scripts on it?
After searching (alot) I've figured out that it should be possible to install perl or even that it's already contains perl. But I'm a total newbie when it comes to things like this, And I can't get it to work :(

All I want to do is to be able to write http://192.168.1.3/helloworld.pl and get it to execute that script (not just show the script code)

My questions is:
Can I run perl scripts?
Is there any step by step guides on how to install perl?
What is the address to the perl handler? (ex: #!/usr/bin/perl)

I've tried to use an .htaccess file with this code:
Options +ExecCGI
AddHandler cgi-script cgi pl
But it does not work either.
I hope you guys can help me!
Ero
I'm New!
I'm New!
 
Posts: 5
Joined: Sat Nov 08, 2008 4:52 pm

Re: Run Perl scripts

Postby merty » Sat Nov 08, 2008 7:17 pm

Hi,

With firmware 7.22 came also perl5.6 . The perl binary is installed in /usr/bin/perl .
Your .htaccess file seems to be fine. I just tested it and could run the following script:
Code: Select all
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>test</TITLE></HEAD><BODY>Hello World !</BODY></HTML>\n";

Be aware that scripts like this want UNIX line endings, instead of DOS. Make sure you've saved it in the right format, otherwise the script will not run. You should find an editor that is capable of saving in UNIX format.

Regards,

Remco
Last edited by merty on Sat Nov 08, 2008 10:28 pm, edited 1 time in total.
merty
Experienced
Experienced
 
Posts: 123
Joined: Mon Sep 15, 2008 7:03 pm

Re: Run Perl scripts

Postby Ero » Sat Nov 08, 2008 9:44 pm

Many thanks Remco!
It was the UNIX file endings that was needed! I would've never figured that out! :)

Now I'm trying to install Hlstats on the server and to do that I need to run a perl file in the background, Their Guide (http://www.hlstats-community.org/index.php?p=doc&m=install) says the following:

There are several ways to start the daemon.(hlstats.pl)
The most common way is to start it with the screen command. But for the first time and check if its working we start it as follow:

cd /path/to/hlstats/daemon/
./hlstats.pl


Is this done in telnet or do I need an external program to be able to start and run an perl file?

Again all help is very appreciated!
Ero
I'm New!
I'm New!
 
Posts: 5
Joined: Sat Nov 08, 2008 4:52 pm

Re: Run Perl scripts

Postby Ero » Sun Nov 09, 2008 1:27 am

Never mind, I found a really good guide and I got it to work! 8)

I'll post the link if anyone else has any problems with this: http://www.lies.com/begperl/hello_command.html
Ero
I'm New!
I'm New!
 
Posts: 5
Joined: Sat Nov 08, 2008 4:52 pm


Return to Web Server + PHP / MySQL + MariaDB

Who is online

Users browsing this forum: No registered users and 0 guests