如何在Apache的PHP页面上调用Perl? [英] How can I call Perl from my PHP page on apache?

查看:49
本文介绍了如何在Apache的PHP页面上调用Perl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的朋友正在为一系列游戏创建一个日志解析器。我们已经在PHP / MySQL中编写了前端(Web),并在Perl中编写了解析器(当然也使用了MySQL)。现在我们在使这两个对象进行通信时遇到了问题。

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.

我们所要做的就是:在一个管理页面上单击解析按钮。当您单击此按钮时,Perl脚本应启动。像 exec( perl /home/www/Init.pm -f games_mp.log)。

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.

我们已经尝试了从系统/执行程序到.htaccess的所有内容,但似乎没有任何可用的方法。实际上根本不起作用。

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

建议?

laka =)

推荐答案

很抱歉,没有简单的设置方法。不同的服务器带有不同的默认apache配置。

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

您可能是要做的是将以下行添加到服务器配置,虚拟主机配置,目录配置或.htaccess中(如果正确设置的话)。

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

您的用户还需要chmod并适当整理文件。

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

实际上,这听起来像是一个长期运行的过程;如果确实如此,那么运行Web浏览器可能会花费很长时间,否则将超时。就是这种情况,您可能需要设置某种作业队列,并每隔5分钟左右就有一个cron脚本执行程序。

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.

这篇关于如何在Apache的PHP页面上调用Perl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆