Question

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 =)

Was it helpful?

Solution

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.

OTHER TIPS

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

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")

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top