shell_exec phpfile

发布于 2024-09-25 23:29:55 字数 600 浏览 0 评论 0原文

我目前使用此代码:

if(isset($_POST['url']) && isset($_POST['trefwoorden']) )
{
  mysql_connect('localhost', 'crawler', 'whathasbeenseencannotbeunseen');
  mysql_select_db("crawler");
  mysql_query("INSERT INTO jobs (jobID, url, trefwoorden) VALUES ('', '".$_POST['url']."', '".$_POST['trefwoorden']."')");
  $output = shell_exec("./content.php " .mysql_insert_id());
  echo $output;

}

在我的 content.php 中,我有以下代码:

#!/usr/bin/php
<?php
echo 'HET WERKT';
?>

现在我想通过填写表单并提交来查看我的 shell_exec 是否实际工作:但它根本不回显任何内容。

我写错代码了吗?

I currently use this code:

if(isset($_POST['url']) && isset($_POST['trefwoorden']) )
{
  mysql_connect('localhost', 'crawler', 'whathasbeenseencannotbeunseen');
  mysql_select_db("crawler");
  mysql_query("INSERT INTO jobs (jobID, url, trefwoorden) VALUES ('', '".$_POST['url']."', '".$_POST['trefwoorden']."')");
  $output = shell_exec("./content.php " .mysql_insert_id());
  echo $output;

}

In my content.php I have the following code:

#!/usr/bin/php
<?php
echo 'HET WERKT';
?>

Now I want to see if my shell_exec actually works by filling in the form and submitting it: but it doesn't echo anything at all.

Did I write wrong code?

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

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

发布评论

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

评论(3

五里雾 2024-10-02 23:29:55

试试这个。这可能对你有帮助。

shell_exec('usr/local/bin/php -l content.php'. mysql_insert_id())

shell_exec('usr/local/bin/php -content.php'. mysql_insert_id())

一切顺利。

谢谢,

康吉

Try this. This may help you.

shell_exec('usr/local/bin/php -l content.php'. mysql_insert_id())

or

shell_exec('usr/local/bin/php -content.php'. mysql_insert_id())

All the best.

Thanks,

Kanji

倥絔 2024-10-02 23:29:55

..也许这对你有用:

shell_exec('php -l content.php'. mysql_insert_id())

或者;

  1. PHP 正在安全模式下运行
  2. Apache 没有执行脚本的权限

.. Maybe this will work for you:

shell_exec('php -l content.php'. mysql_insert_id())

Or;

  1. PHP is running in safe_mode
  2. Apache does not have the permissions to execute the script
停滞 2024-10-02 23:29:55

为什么调用 PHP 文件而不包含它?

此外,我同意Chouchenos的观点,因为这行代码:

shell_exec('php -l content.php'. mysql_insert_id())

如果mysql_insert_id()返回id 132,将像这样执行“php -l content.php132”。

这可能是一个问题,因为content.php132可能不存在。

Why do you invoke a PHP file and not including it?

Besides, I agree with Chouchenos because this line of code:

shell_exec('php -l content.php'. mysql_insert_id())

will execute like this "php -l content.php132" if mysql_insert_id() returns the id 132.

This might be a problem because content.php132 might not be existant.

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