[英]Calling Perl script with PHP, passing variables and put result into a file
I am near losing my mind cause of a perl script I want to call via PHP. 我几乎不介意要通过PHP调用的Perl脚本。
I have a PHP Form where I put in a MySQL Query which gets stored in a file and choosing some variables. 我有一个PHP表单,在其中放入了存储在文件中并选择一些变量的MySQL查询。
If I call any SHELL command like "top" ... everything works fine, but as soon as I try to call my perl script with variables, there are no results at all. 如果我调用任何诸如“ top”之类的SHELL命令……一切正常,但是一旦我尝试用变量调用我的perl脚本,就根本没有结果。
The file where the results should get stored stays empty. 结果应存储在其中的文件保持为空。
That's the calling part from the PHP File: 那是PHP文件的调用部分:
if (isset($_POST['submit'])) {
$file = 'query.sql';
$query = $_POST['query'];
file_put_contents($file, $query);
$command = "perl /home/www/host/html/cgi/remote-board-exec.pl -sqlfileexec query.sql > /home/www/host/html/cgi/passthrutest.txt";
exec($command, &$ausgabe, $return_var);
There is no error message and i already tried debug things, but nothing helped :( 没有错误信息,我已经尝试调试了,但是没有帮助:(
Are you sure that perl is being executed? 您确定正在执行perl吗? Perhaps you ought to replace the command with 'which perl' just to make sure, and to use the full path to Perl.
也许您应该将命令替换为“ which perl”以确保并使用指向Perl的完整路径。 Another idea is to make sure your:
另一个想法是确保您:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.