如何从 apache 上的 PHP 页面调用 Perl?

发布于 2024-07-18 04:45:23 字数 345 浏览 5 评论 0原文

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

我们不想做的就是这样:一个在线管理页面,其中有“解析”按钮。 当您单击此按钮时,Perl 脚本应该启动。 就像 "exec("perl /home/www/Init.pm -f games_mp.log")。

这可能吗?记住,它应该很容易设置。

我们已经尝试了从 system/exec 到 .htaccess 的所有内容,但似乎没有什么是开箱即用的,真的没有

什么建议

吗?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

眼泪都笑了 2024-07-25 04:45:23

为什么不使用 mod_perl 运行 Perl 脚本,就好像它们是来自 jQuery 的网页一样?

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

舟遥客 2024-07-25 04:45:23

我敢打赌您会遇到路径错误。 尝试提供 Perl 可执行文件的完整路径。 例如:

exec("/usr/bin/perl /home/www/Init.pm -f games_mp.log")

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")
挽心 2024-07-25 04:45:23

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

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

AddHandler cgi-script .cgi .pl .pm

您的用户还需要适当地 chmod 和 chown 文件。

事实是,这听起来像是一个长期运行的过程。 如果是,那么运行 Web 浏览器可能需要很长时间才能完成。 如果是这种情况,您可能需要设置某种作业队列,并每隔 5 分钟左右执行一个基于该队列的 cron 脚本。

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.

热鲨 2024-07-25 04:45:23

在 PHP 中,很多事情都取决于配置。 尝试调查一下,因为许多操作员都可以被禁用。

检查 Perl 程序是否具有正确的权限。 尝试从命令行运行 Perl 程序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文