Search code examples
phpshellexecutepcntl

shell_exec phpfile


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?


Solution

  • 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