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.
我的朋友和我正在为一系列游戏创建一个日志解析器。我们在PHP / MySQL中编写了前端(web),在Perl中编写了解析器(当然也使用了MySQL)。现在我们在让这两个人沟通时遇到了问题。
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").
我们不想做的就是:在线管理页面,您可以点击“解析”按钮。单击此按钮时,应启动Perl脚本。比如“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.
我们已尝试过从system / exec到.htaccess的所有内容,但似乎没有任何东西可以开箱即用。真的没有工作。
Suggestions?
laka =)
4 个解决方案
#1
0
I'm sorry to say there's no easy way to set this up. Different servers come with different default apache configs.
我很遗憾地说没有简单的方法来设置它。不同的服务器带有不同的默认apache配置。
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.
您可能要做的是在服务器配置,虚拟主机配置,目录配置中添加以下行,或者,如果正确设置,.htaccess。
AddHandler cgi-script .cgi .pl .pm
AddHandler cgi-script .cgi .pl .pm
Your users will also need to chmod and chown the files appropriately.
您的用户还需要适当地chmod和chown文件。
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.
事实上,这听起来像是一个漫长的过程。如果是,那么运行Web浏览器可能需要很长时间才能完成。如果是这种情况,你可能想要设置某种作业队列,并且每5分钟左右就有一个基于cron脚本的exec。
#2
2
Why not run the Perl script as if they were a web page from jQuery using mod_perl?
为什么不使用mod_perl运行Perl脚本就好像它们是来自jQuery的网页?
#3
1
I'm willing to bet you are running into pathing errors. Try providing the full path to the Perl executable. For example:
我愿意打赌你遇到了路径错误。尝试提供Perl可执行文件的完整路径。例如:
exec("/usr/bin/perl /home/www/Init.pm -f games_mp.log")
#4
0
In PHP many things depend on configuration. Try looking into it as many operators can be disabled.
在PHP中,很多东西都依赖于配置。尝试查看它,因为可以禁用许多运算符。
Check that Perl program has correct rights. Try running you Perl program from command line.
检查Perl程序是否具有正确的权限。尝试从命令行运行Perl程序。
#1
0
I'm sorry to say there's no easy way to set this up. Different servers come with different default apache configs.
我很遗憾地说没有简单的方法来设置它。不同的服务器带有不同的默认apache配置。
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.
您可能要做的是在服务器配置,虚拟主机配置,目录配置中添加以下行,或者,如果正确设置,.htaccess。
AddHandler cgi-script .cgi .pl .pm
AddHandler cgi-script .cgi .pl .pm
Your users will also need to chmod and chown the files appropriately.
您的用户还需要适当地chmod和chown文件。
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.
事实上,这听起来像是一个漫长的过程。如果是,那么运行Web浏览器可能需要很长时间才能完成。如果是这种情况,你可能想要设置某种作业队列,并且每5分钟左右就有一个基于cron脚本的exec。
#2
2
Why not run the Perl script as if they were a web page from jQuery using mod_perl?
为什么不使用mod_perl运行Perl脚本就好像它们是来自jQuery的网页?
#3
1
I'm willing to bet you are running into pathing errors. Try providing the full path to the Perl executable. For example:
我愿意打赌你遇到了路径错误。尝试提供Perl可执行文件的完整路径。例如:
exec("/usr/bin/perl /home/www/Init.pm -f games_mp.log")
#4
0
In PHP many things depend on configuration. Try looking into it as many operators can be disabled.
在PHP中,很多东西都依赖于配置。尝试查看它,因为可以禁用许多运算符。
Check that Perl program has correct rights. Try running you Perl program from command line.
检查Perl程序是否具有正确的权限。尝试从命令行运行Perl程序。