tags:

views:

418

answers:

6

Hi, my friend and I are creating a log parser for a series of games. We have written the frontend (web) in PHP/MySQL and the parser in Perl (also using MySQL, of course). Now we are having problems getting these two to communicate.

All we wan't to do is this: one administration page online where you have the button "parse". When you click this a Perl script should start. Like "exec("perl /home/www/Init.pm -f games_mp.log").

Is this possible? Remember, it's suppose to be easy to set up.

We've tried everything from system/exec to .htaccess, but nothing seems to work out of the box. Not working at all really.

Suggestions?

laka =)

+1  A: 

I'm willing to bet you are running into pathing errors. Try providing the full path to the Perl executable. For example:

exec("/usr/bin/perl /home/www/Init.pm -f games_mp.log")
Jordan S. Jones
No, my paths are okay :-)
Lasse A Karlsen
+2  A: 

Why not run the Perl script as if they were a web page from jQuery using mod_perl?

eed3si9n
Because like I said, this is suppose to work out of the box.. not many gamers willing to install mod_perl..
Lasse A Karlsen
A: 

I'm sorry to say there's no easy way to set this up. Different servers come with different default apache configs.

What you're probably looking to do is add the following line inside the either the server config, virtual host config, directory config, or, if properly setup, .htaccess.

AddHandler cgi-script .cgi .pl .pm

Your users will also need to chmod and chown the files appropriately.

Thing is, this sounds like a long running process. If it is, then it might take so long to run the web browser will time out before it is done. If that's the case, you'll likely want to setup some kind of job queue and have a cron script exec based off that every 5 min or so.

Andrew Cholakian
Damn.. I would have written it all in PHP if I knew it would be this hard to make it work.
Lasse A Karlsen
A: 

In PHP many things depend on configuration. Try looking into it as many operators can be disabled.

Check that Perl program has correct rights. Try running you Perl program from command line.

Alexandr Ciornii
A: 

Using Perl Code from PHP.

Youdaman